Ajout d'un système de suggestion via intégration gitlab + correction de /setgoodbye et DM arrivée
This commit is contained in:
parent
50a1936b89
commit
997b897b28
20 changed files with 43667 additions and 204 deletions
|
|
@ -69,6 +69,43 @@ class BugReportModal(discord.ui.Modal, title="Signaler un Bug"):
|
|||
else:
|
||||
await interaction.edit_original_response(content="❌ Une erreur est survenue lors de l'envoi du rapport à GitLab. Veuillez contacter un administrateur.")
|
||||
|
||||
class FeatureSuggestionModal(discord.ui.Modal, title="Suggérer une fonctionnalité"):
|
||||
suggestion_title = discord.ui.TextInput(
|
||||
label="Titre de la suggestion",
|
||||
placeholder="Que voulez-vous ajouter ?",
|
||||
required=True,
|
||||
max_length=100
|
||||
)
|
||||
|
||||
description = discord.ui.TextInput(
|
||||
label="Détails de la fonctionnalité",
|
||||
style=discord.TextStyle.paragraph,
|
||||
placeholder="Décrivez comment cela devrait fonctionner...",
|
||||
required=True,
|
||||
max_length=1000
|
||||
)
|
||||
|
||||
async def on_submit(self, interaction: discord.Interaction):
|
||||
await interaction.response.send_message("Envoi de votre suggestion à GitLab...", ephemeral=True)
|
||||
|
||||
description_text = f"**Suggéré par:** {interaction.user} ({interaction.user.id})\n\n"
|
||||
description_text += f"**Description:**\n{self.description.value}"
|
||||
|
||||
labels = ["enhancement", "manual-suggestion"]
|
||||
|
||||
result = await gitlab_client.create_issue(
|
||||
title=f"[SUGGESTION] {self.suggestion_title.value}",
|
||||
description=description_text,
|
||||
labels=labels
|
||||
)
|
||||
|
||||
if result:
|
||||
issue_iid = result.get("iid")
|
||||
save_report(issue_iid, interaction.user.id)
|
||||
await interaction.edit_original_response(content=f"✅ Votre suggestion a été envoyée avec succès ! Merci de contribuer à l'amélioration du bot. [Voir l'issue]({result.get('web_url')})")
|
||||
else:
|
||||
await interaction.edit_original_response(content="❌ Une erreur est survenue lors de l'envoi de la suggestion à GitLab.")
|
||||
|
||||
class BugReport(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
|
@ -98,12 +135,17 @@ class BugReport(commands.Cog):
|
|||
user = self.bot.get_user(user_id)
|
||||
if user:
|
||||
try:
|
||||
is_suggestion = "[SUGGESTION]" in issue.get('title', '')
|
||||
title_type = "Suggestion Implémentée !" if is_suggestion else "🛠️ Bug Résolu !"
|
||||
msg_type = "suggestion" if is_suggestion else "bug"
|
||||
status_val = "Implémenté / Terminé" if is_suggestion else "Terminé / Résolu"
|
||||
|
||||
embed = discord.Embed(
|
||||
title="🛠️ Bug Résolu !",
|
||||
description=f"Bonne nouvelle ! Le bug que vous avez signalé (**{issue.get('title')}**) a été marqué comme terminé sur GitLab.",
|
||||
title=title_type,
|
||||
description=f"Bonne nouvelle ! Votre {msg_type} (**{issue.get('title')}**) a été marqué comme terminé sur GitLab.",
|
||||
color=discord.Color.green()
|
||||
)
|
||||
embed.add_field(name="Statut", value="Terminé / Résolu")
|
||||
embed.add_field(name="Statut", value=status_val)
|
||||
embed.add_field(name="Prochaine étape", value="La mise à jour arrive prochainement !")
|
||||
embed.set_footer(text="Merci de votre aide pour améliorer le bot.")
|
||||
await user.send(embed=embed)
|
||||
|
|
@ -133,5 +175,9 @@ class BugReport(commands.Cog):
|
|||
async def signaler_bug(self, interaction: discord.Interaction, priority: app_commands.Choice[str]):
|
||||
await interaction.response.send_modal(BugReportModal(priority))
|
||||
|
||||
@app_commands.command(name="suggerer_fonctionnalite", description="Proposer une nouvelle fonctionnalité pour le bot")
|
||||
async def suggerer_fonctionnalite(self, interaction: discord.Interaction):
|
||||
await interaction.response.send_modal(FeatureSuggestionModal())
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(BugReport(bot))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue