dev #1
|
@ -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))
|
25
main.py
25
main.py
|
@ -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.
|
||||
"""
|
||||
|
@ -75,7 +82,7 @@ async def edt(
|
|||
\nVotre emploi du temps (`EDT-{groupe}-{langues.value}.ics`) pour le groupe `{groupe}`, `{langues.name}` au format `.ics` a bien été généré, **avec les colles**
|
||||
\n\nVous pouvez importer ces fichiers dans la plupart des calendriers, mais il est recommandé de créer un nouveau sous-calendrier pour facilement pouvoir le changer.
|
||||
"""
|
||||
|
||||
|
||||
await interaction.response.send_message(message, files=fichiers)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue