Parcourir la source

Outsourced the how_to_start command into a cogs file. Made final changes in the how_to_team cog

BaumSplitter41 il y a 4 mois
Parent
commit
9121c5ab3c
3 fichiers modifiés avec 58 ajouts et 44 suppressions
  1. 55 0
      VPD_BOT/cogs/how_to_start.py
  2. 3 3
      VPD_BOT/cogs/how_to_team.py
  3. 0 41
      VPD_BOT/main.py

+ 55 - 0
VPD_BOT/cogs/how_to_start.py

@@ -0,0 +1,55 @@
+import discord
+from discord.ext import commands
+from discord.commands import Option
+from discord.commands import slash_command
+import os
+from dotenv import load_dotenv
+
+class howtostart(commands.Cog):
+    def __init__(self, bot: discord.Bot):
+        self.bot = bot
+
+    intents = discord.Intents.default()
+    intents.message_content = True
+    intents.members = True
+    intents.guilds = True
+    intents.reactions = True
+
+    client = discord.Client(intents=intents)
+    debug_guilds_up = []
+    server_token = os.getenv("SERVER").split(",")
+    for i in range(len(server_token)):
+        debug_guilds_up.append(int(server_token[i]))
+    
+    bot = commands.Bot(
+    command_prefix=commands.when_mentioned_or("!"),
+    description="VicePD Bot",
+    intents=intents,
+    debug_guilds=debug_guilds_up if debug_guilds_up else None
+    )
+
+
+#Command initialization
+    @bot.slash_command(name="how_to_start", description= "Get Infos")
+    async def how_to_start(
+        self,
+        ctx,
+    ):
+        server = ctx.guild
+        embed = discord.Embed(
+            title=f"__How to start__",
+            description=f"Hallo {ctx.author.mention}, um auf unserem Server spielen zu können, ließ dir zuerst das Regelwerk in in #regelwerk durch. Um einem Department beizutreten wähle in #how-to-start eine Einweisungsrolle aus. Melde dich anschließend für eine Einweisung an. **Wichtig: gehe erst krz vor der Einweisung auf den Server!**",
+            color=discord.Color.yellow()
+        )
+
+
+        embed.set_thumbnail(url=server.icon)
+        embed.set_author(name="VicePD", icon_url="https://i.imgur.com/6QteFrg.png")
+        embed.set_footer(text="VicePD - Bot | Made by BaumSplitter41")
+
+        await ctx.respond(embed=embed)
+
+
+
+def setup(bot: discord.Bot):
+    bot.add_cog(howtostart(bot))

+ 3 - 3
VPD_BOT/cogs/how_to_team.py

@@ -5,7 +5,7 @@ from discord.commands import slash_command
 import os
 from dotenv import load_dotenv
 
-class howtteam(commands.Cog):
+class howtoteam(commands.Cog):
     def __init__(self, bot: discord.Bot):
         self.bot = bot
 
@@ -30,7 +30,7 @@ class howtteam(commands.Cog):
 
 
 #Command initialization
-    @bot.slash_command(name="how_to_team", description= "Get Infos")
+    @bot.slash_command(name="how_to_team", description= "Get Infos on how to join the Team on this Server")
     async def how_to_team(
         self,
         ctx,
@@ -51,4 +51,4 @@ class howtteam(commands.Cog):
 
 
 def setup(bot: discord.Bot):
-    bot.add_cog(howtteam(bot))
+    bot.add_cog(howtoteam(bot))

+ 0 - 41
VPD_BOT/main.py

@@ -551,47 +551,6 @@ async def setup_rr(
 #_________________________________#
 ## Help System
 
-#---------------------------------#
-#How to team
-
-"""@bot.slash_command(name="how_to_team", description= "Get Infos")
-async def how_to_team(
-    ctx,
-):
-    server = ctx.guild
-    embed = discord.Embed(
-        title=f"__How to join the Team on {server.name}__",
-        description=f"If you want to join the Serverteam open a ticket in #ticket.",
-        color=discord.Color.yellow()
-    )
-
-
-    embed.set_thumbnail(url=server.icon)
-    embed.set_author(name="VicePD", icon_url="https://i.imgur.com/6QteFrg.png")
-    embed.set_footer(text="VicePD - Bot | Made by BaumSplitter41")
-
-    await ctx.respond(embed=embed)"""
-
-#---------------------------------#
-#How to start
-@bot.slash_command(name="how_to_start", description= "Get Infos")
-async def how_to_start(
-    ctx,
-):
-    server = ctx.guild
-    embed = discord.Embed(
-        title=f"__How to start__",
-        description=f"Hallo {ctx.author.mention}, um auf unserem Server spielen zu können, ließ dir zuerst das Regelwerk in in #regelwerk durch. Um einem Department beizutreten wähle in #how-to-start eine Einweisungsrolle aus. Melde dich anschließend für eine Einweisung an. **Wichtig: gehe erst krz vor der Einweisung auf den Server!**",
-        color=discord.Color.yellow()
-    )
-
-
-    embed.set_thumbnail(url=server.icon)
-    embed.set_author(name="VicePD", icon_url="https://i.imgur.com/6QteFrg.png")
-    embed.set_footer(text="VicePD - Bot | Made by BaumSplitter41")
-
-    await ctx.respond(embed=embed)
-
 #---------------------------------#
 #Help_cache
 @bot.slash_command(name="help_cache", description= "Get Infos")