Migration vers Disnake et ajout des components V2

This commit is contained in:
Mathis 2026-05-09 18:42:42 +02:00
parent c8c579eefe
commit 98f7501e07
47 changed files with 1196 additions and 722 deletions

View file

@ -83,12 +83,12 @@ def parse_date(date_str: str):
class AbsenceModal(disnake.ui.Modal):
def __init__(self, superieur: Optional[disnake.Member] = None):
super().__init__(title="Déclarer une Absence Staff")
super().__init__(title="Déclarer une Absence Staff", components=[self.motif, self.date_debut, self.date_fin])
self.superieur = superieur
motif = disnake.ui.TextInput(
label="Motif de l'absence",
style=disnake.TextStyle.paragraph,
style=disnake.TextInputStyle.paragraph,
placeholder="Ex: Vacances, Raisons personnelles, Travail...",
required=True,
max_length=500
@ -187,7 +187,7 @@ class AbsenceConfigView(disnake.ui.View):
self.guild_id = guild_id
@disnake.ui.button(label="Définir le Salon", style=disnake.ButtonStyle.primary, emoji="📁")
async def set_channel(self, interaction: disnake.Interaction, button: disnake.ui.Button):
async def set_channel(self, button: disnake.ui.Button, interaction: disnake.Interaction):
await interaction.response.send_message("Mentionne le salon ici (ou envoie son ID) :", ephemeral=True)
def check(m):
@ -214,7 +214,7 @@ class AbsenceConfigView(disnake.ui.View):
await interaction.followup.send("❌ Temps écoulé.", ephemeral=True)
@disnake.ui.button(label="Définir le Rôle", style=disnake.ButtonStyle.primary, emoji="🎭")
async def set_role(self, interaction: disnake.Interaction, button: disnake.ui.Button):
async def set_role(self, button: disnake.ui.Button, interaction: disnake.Interaction):
await interaction.response.send_message("Mentionne le rôle ici (ou envoie son ID) :", ephemeral=True)
def check(m):
@ -499,7 +499,7 @@ class Absence(commands.Cog):
settings = load_settings(message.guild.id)
channel_id = settings.get("absence_channel_id")
absence_url = f"https://discord.com/channels/{message.guild.id}/{channel_id}/{msg_id}" if channel_id and msg_id else ""
absence_url = f"https://disnake.com/channels/{message.guild.id}/{channel_id}/{msg_id}" if channel_id and msg_id else ""
reply_text = f"⚠️ {message.author.mention}, cet utilisateur est actuellement absent."
if absence_url:
@ -507,5 +507,5 @@ class Absence(commands.Cog):
await message.reply(reply_text, delete_after=30)
async def setup(bot):
await bot.add_cog(Absence(bot))
def setup(bot):
bot.add_cog(Absence(bot))