Migration vers Disnake et ajout des components V2
This commit is contained in:
parent
c8c579eefe
commit
98f7501e07
47 changed files with 1196 additions and 722 deletions
|
|
@ -195,7 +195,7 @@ class ContinueFormView(disnake.ui.View):
|
|||
self.step2_part2_data = step2_part2_data
|
||||
|
||||
@disnake.ui.button(label="📋 Continuer le formulaire", style=disnake.ButtonStyle.green, custom_id="continue_form")
|
||||
async def continue_form(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def continue_form(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
"""Passe à l'étape suivante du formulaire"""
|
||||
if self.current_step == 1:
|
||||
await interaction.response.send_modal(TicketStep2Part1(self.step1_data))
|
||||
|
|
@ -414,7 +414,7 @@ class TicketManagementView(disnake.ui.View):
|
|||
return None
|
||||
|
||||
@disnake.ui.button(label="🔒 Fermer le Ticket", style=disnake.ButtonStyle.red, custom_id="close_ticket")
|
||||
async def close_ticket(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def close_ticket(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
"""Ferme le ticket en désactivant l'envoi de messages pour le membre"""
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
|
|
@ -445,7 +445,7 @@ class TicketManagementView(disnake.ui.View):
|
|||
await interaction.followup.send(f"❌ Erreur lors de la fermeture : {e}", ephemeral=True)
|
||||
|
||||
@disnake.ui.button(label="👤 Claim le Ticket", style=disnake.ButtonStyle.blurple, custom_id="claim_ticket")
|
||||
async def claim_ticket(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def claim_ticket(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
"""Un staff prend en charge le ticket"""
|
||||
await interaction.response.defer(ephemeral=False)
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ class ClosedTicketView(disnake.ui.View):
|
|||
return None
|
||||
|
||||
@disnake.ui.button(label="♻ Réouvrir le Ticket", style=disnake.ButtonStyle.green, custom_id="reopen_ticket")
|
||||
async def reopen_ticket(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def reopen_ticket(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
"""Réouvre le ticket pour le membre"""
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
|
|
@ -526,15 +526,15 @@ class ReopenStatusView(disnake.ui.View):
|
|||
self.owner = owner
|
||||
|
||||
@disnake.ui.button(label="Écrit (Ouvert)", style=disnake.ButtonStyle.secondary)
|
||||
async def set_written(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def set_written(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
await self.apply_status(interaction, "ouvert")
|
||||
|
||||
@disnake.ui.button(label="Oral (À faire)", style=disnake.ButtonStyle.primary)
|
||||
async def set_oral(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def set_oral(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
await self.apply_status(interaction, "oral-à-faire")
|
||||
|
||||
@disnake.ui.button(label="Accepté", style=disnake.ButtonStyle.success)
|
||||
async def set_accepted(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def set_accepted(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
await self.apply_status(interaction, "accepté")
|
||||
|
||||
async def apply_status(self, interaction: disnake.Interaction, prefix: str):
|
||||
|
|
@ -585,7 +585,7 @@ class ReopenStatusView(disnake.ui.View):
|
|||
await interaction.followup.send(f"❌ Erreur système : {e}", ephemeral=True)
|
||||
|
||||
@disnake.ui.button(label="❌ Supprimer le Ticket", style=disnake.ButtonStyle.danger, custom_id="delete_ticket")
|
||||
async def delete_ticket(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def delete_ticket(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
"""Supprime le salon du ticket"""
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
|
|
@ -611,7 +611,7 @@ class TicketView(disnake.ui.View):
|
|||
super().__init__(timeout=None)
|
||||
|
||||
@disnake.ui.button(label="📑 Ouvrir un Ticket Whitelist", style=disnake.ButtonStyle.red, custom_id="open_ticket")
|
||||
async def open_ticket(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def open_ticket(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
"""Affiche le premier formulaire"""
|
||||
await interaction.response.send_modal(TicketStep1())
|
||||
|
||||
|
|
@ -799,8 +799,8 @@ class Ticket(commands.Cog):
|
|||
kuby_logger.error(f"Erreur lors de la validation du ticket: {e}", exc_info=True)
|
||||
await message.channel.send(f"❌ Une erreur système est survenue : {e}")
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(Ticket(bot))
|
||||
def setup(bot):
|
||||
bot.add_cog(Ticket(bot))
|
||||
bot.add_view(TicketView())
|
||||
bot.add_view(TicketManagementView())
|
||||
bot.add_view(ClosedTicketView())
|
||||
Loading…
Add table
Add a link
Reference in a new issue