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
|
|
@ -15,11 +15,11 @@ class FeedbackView(disnake.ui.View):
|
|||
self.add_item(RatingSelect())
|
||||
|
||||
@disnake.ui.button(label="📝 Laisser un commentaire", style=disnake.ButtonStyle.secondary, custom_id="feedback_comment", row=1)
|
||||
async def comment_button(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def comment_button(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
await interaction.response.send_modal(FeedbackModal(self))
|
||||
|
||||
@disnake.ui.button(label="✅ Envoyer", style=disnake.ButtonStyle.green, custom_id="feedback_submit", row=1)
|
||||
async def submit_button(self, interaction: disnake.Interaction, button: disnake.ui.Button):
|
||||
async def submit_button(self, button: disnake.ui.Button, interaction: disnake.Interaction):
|
||||
if self.rating == 0:
|
||||
await interaction.response.send_message("❌ Veuillez sélectionner une note avant d'envoyer.", ephemeral=True)
|
||||
return
|
||||
|
|
@ -128,17 +128,17 @@ class RatingSelect(disnake.ui.Select):
|
|||
|
||||
class FeedbackModal(disnake.ui.Modal):
|
||||
def __init__(self, view):
|
||||
super().__init__(title="Votre avis")
|
||||
super().__init__(components=[], title="Votre avis")
|
||||
self.view = view
|
||||
self.comment = disnake.ui.TextInput(
|
||||
label="Commentaire",
|
||||
style=disnake.TextStyle.paragraph,
|
||||
style=disnake.TextInputStyle.paragraph,
|
||||
placeholder="Dites-nous ce que vous avez pensé du support...",
|
||||
required=True,
|
||||
max_length=1000
|
||||
)
|
||||
self.add_item(self.comment)
|
||||
self.append_component(self.comment)
|
||||
|
||||
async def on_submit(self, interaction: disnake.Interaction):
|
||||
async def callback(self, interaction: disnake.Interaction):
|
||||
self.view.comment = self.comment.value
|
||||
await interaction.response.send_message("Commentaire enregistré ! N'oubliez pas de valider avec 'Envoyer'.", ephemeral=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue