Cogs system initialised

This commit is contained in:
voXrey 2023-12-16 21:31:36 +01:00
parent 696d3921cb
commit 74ff357853
2 changed files with 27 additions and 9 deletions

11
cogs/cog_edt.py Normal file
View File

@ -0,0 +1,11 @@
from discord.ext import commands
class EDT:
def __init__(self, bot):
self.bot = bot
print("EDT loaded")
def setup(bot):
bot.add_cog(EDT(bot))

23
main.py
View File

@ -16,10 +16,17 @@ MY_GUILD = discord.Object(id=getenv("GUILD_ID")) # replace with your guild id
class MyClient(discord.Client):
def __init__(self):
super().__init__(intents=None)
super().__init__(intents=discord.Intents.none())
self.tree = app_commands.CommandTree(self)
self.initial_extensions = ["cogs." + f[:-3] for f in os.listdir("./cogs") if f.endswith(".py") and f.name != "__init__.py"]
async def setup_hook(self):
# cogs
for extension in self.initial_extensions:
await self.load_extension(extension)
self.tree.copy_global_to(guild=MY_GUILD)
await self.tree.sync(guild=MY_GUILD)
@ -29,7 +36,6 @@ client = MyClient()
eleves = get_eleves()
@client.event
async def on_ready():
print(f'Logged in as {client.user} (ID: {client.user.id})')
@ -43,16 +49,17 @@ async def on_ready():
Choice(name='Anglais LV1, Espagnol LV2', value="EN-ES"),
Choice(name='Allemand LV1, Anglais LV2', value="DE-EN"),
Choice(name='Espagnol LV1, Anglais LV2', value="ES-EN")
]
]
)
@app_commands.describe(groupe="Votre groupe de colle, groupe ∈ ⟦1, 15⟧")
@app_commands.describe(langues="Les options de langue que vous suivez. (Les langues suivies à H4 ne sont pas gérées, mettez 'Autres')")
@app_commands.describe(
langues="Les options de langue que vous suivez. (Les langues suivies à H4 ne sont pas gérées, mettez 'Autres')")
@app_commands.describe(split="Créer deux fichiers différentes, un pour les colles et un pour le rest de l'EDT.")
async def edt(
interaction: discord.Interaction,
groupe: app_commands.Range[int, 1, 15],
langues: Choice[str],
split: bool = False):
interaction: discord.Interaction,
groupe: app_commands.Range[int, 1, 15],
langues: Choice[str],
split: bool = False):
"""
Génère un emploi du temps prenant compte des colles, des langues et de la semaine.
"""