Merge branch 'dev' into 'main'
Debug GitLab note DM v7 See merge request Omega_Kube/kuby!23
This commit is contained in:
commit
c71b1d6c52
1 changed files with 35 additions and 54 deletions
|
|
@ -165,8 +165,9 @@ class FeatureSuggestionModal(disnake.ui.Modal):
|
|||
class BugReport(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
# disnake 2.12: `cog_load` async n'est pas appelé comme dans discord.py.
|
||||
# On lance le serveur aiohttp de façon différée.
|
||||
|
||||
async def cog_load(self):
|
||||
# Disnake appelle automatiquement cette méthode dès que la boucle d'événements est active.
|
||||
self.bot.loop.create_task(self._start_webhook_server())
|
||||
|
||||
async def _start_webhook_server(self):
|
||||
|
|
@ -301,24 +302,18 @@ class BugReport(commands.Cog):
|
|||
current_labels_str = "Mis à jour"
|
||||
|
||||
try:
|
||||
components = [
|
||||
disnake.ui.Container(
|
||||
disnake.ui.Section(
|
||||
"🛠️ Mise à jour de votre signalement !",
|
||||
accessory=disnake.ui.Thumbnail(self.bot.user.display_avatar.url),
|
||||
),
|
||||
disnake.ui.Separator(divider=True),
|
||||
disnake.ui.TextDisplay(
|
||||
f"Le statut de votre rapport **{issue_title}** a été mis à jour par l'équipe."
|
||||
),
|
||||
disnake.ui.TextDisplay(
|
||||
f"📌 **Nouveaux Labels / Statuts :** {current_labels_str}"
|
||||
),
|
||||
)
|
||||
]
|
||||
embed = disnake.Embed(
|
||||
title="🛠️ Mise à jour de votre signalement !",
|
||||
description=(
|
||||
f"Le statut de votre rapport **{issue_title}** a été mis à jour par l'équipe.\n\n"
|
||||
f"📌 **Nouveaux Labels / Statuts :** {current_labels_str}"
|
||||
),
|
||||
color=disnake.Color.blue()
|
||||
)
|
||||
embed.set_thumbnail(url=self.bot.user.display_avatar.url)
|
||||
|
||||
try:
|
||||
await user.send(components=components)
|
||||
await user.send(embed=embed)
|
||||
kuby_logger.info(
|
||||
f"Notification de label envoyée à {user} ({user.id}) pour l'issue #{issue_iid}"
|
||||
)
|
||||
|
|
@ -350,25 +345,19 @@ class BugReport(commands.Cog):
|
|||
|
||||
if is_closing_now:
|
||||
try:
|
||||
components = [
|
||||
disnake.ui.Container(
|
||||
disnake.ui.Section(
|
||||
"🛠️ Bug / Suggestion Terminé(e) !",
|
||||
accessory=disnake.ui.Thumbnail(self.bot.user.display_avatar.url),
|
||||
),
|
||||
disnake.ui.Separator(divider=True),
|
||||
disnake.ui.TextDisplay(
|
||||
f"Bonne nouvelle ! Votre signalement **{issue_title}** a été marqué comme terminé ou résolu."
|
||||
),
|
||||
disnake.ui.TextDisplay(
|
||||
"🚀 **Prochaine étape :** La mise à jour arrive prochainement (ou est déjà là) !"
|
||||
),
|
||||
disnake.ui.TextDisplay("✨ Merci pour votre aide !"),
|
||||
)
|
||||
]
|
||||
embed = disnake.Embed(
|
||||
title="🛠️ Bug / Suggestion Terminé(e) !",
|
||||
description=(
|
||||
f"Bonne nouvelle ! Votre signalement **{issue_title}** a été marqué comme terminé ou résolu.\n\n"
|
||||
f"🚀 **Prochaine étape :** La mise à jour arrive prochainement (ou est déjà là) !\n"
|
||||
f"✨ Merci pour votre aide !"
|
||||
),
|
||||
color=disnake.Color.green()
|
||||
)
|
||||
embed.set_thumbnail(url=self.bot.user.display_avatar.url)
|
||||
|
||||
try:
|
||||
await user.send(components=components)
|
||||
await user.send(embed=embed)
|
||||
kuby_logger.info(
|
||||
f"Notification de clôture envoyée à {user} ({user.id}) pour l'issue #{issue_iid}"
|
||||
)
|
||||
|
|
@ -402,7 +391,6 @@ class BugReport(commands.Cog):
|
|||
)
|
||||
|
||||
if not is_system:
|
||||
# GitLab peut envoyer des champs différents selon version/config
|
||||
note_body = (
|
||||
note_attr.get("note")
|
||||
or note_attr.get("body")
|
||||
|
|
@ -413,24 +401,19 @@ class BugReport(commands.Cog):
|
|||
author_name = payload.get("user", {}).get("name", "Développeur")
|
||||
|
||||
try:
|
||||
components = [
|
||||
disnake.ui.Container(
|
||||
disnake.ui.Section(
|
||||
"💬 Nouveau commentaire sur votre signalement",
|
||||
accessory=disnake.ui.Thumbnail(self.bot.user.display_avatar.url),
|
||||
),
|
||||
disnake.ui.Separator(divider=True),
|
||||
disnake.ui.TextDisplay(
|
||||
f"Le développeur a répondu à votre rapport **{issue_title}** :"
|
||||
),
|
||||
disnake.ui.TextDisplay(f">>> {note_body}"),
|
||||
disnake.ui.Separator(divider=True),
|
||||
disnake.ui.TextDisplay(f"✍️ **Par :** {author_name}"),
|
||||
)
|
||||
]
|
||||
embed = disnake.Embed(
|
||||
title="💬 Nouveau commentaire sur votre signalement",
|
||||
description=(
|
||||
f"Le développeur a répondu à votre rapport **{issue_title}** :\n\n"
|
||||
f">>> {note_body}\n\n"
|
||||
f"✍️ **Par :** {author_name}"
|
||||
),
|
||||
color=disnake.Color.orange()
|
||||
)
|
||||
embed.set_thumbnail(url=self.bot.user.display_avatar.url)
|
||||
|
||||
try:
|
||||
await user.send(components=components)
|
||||
await user.send(embed=embed)
|
||||
kuby_logger.info(
|
||||
f"Commentaire GitLab envoyé à {user} ({user.id}) pour l'issue #{issue_iid}"
|
||||
)
|
||||
|
|
@ -467,14 +450,12 @@ class BugReport(commands.Cog):
|
|||
choices={"Basse": "Low", "Normale": "Normal", "Haute": "High", "Urgente": "Urgent"},
|
||||
),
|
||||
):
|
||||
# Simulate app_commands.Choice behavior for existing code
|
||||
from collections import namedtuple
|
||||
|
||||
Choice = namedtuple('Choice', ['name', 'value'])
|
||||
mapping = {"Basse": "Low", "Normale": "Normal", "Haute": "High", "Urgente": "Urgent"}
|
||||
reverse = {v: k for k, v in mapping.items()}
|
||||
|
||||
# priority vient du value GitLab (Low/Normal/High/Urgent)
|
||||
p_name = reverse.get(priority, "Normal")
|
||||
choice = Choice(name=p_name, value=priority)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue