fix(modmail): button custom_id mismatch causing interaction timeout
All checks were successful
deploy / deploy (push) Successful in 21s

- PersistentQuickOpen expects custom_id='modmail_quick_open'
- Panel button had custom_id='modmail_quick_open:{key}' (mismatch)
- Discord couldn't find the handler -> 3s timeout
- Added error logging on CategorySelect callback
This commit is contained in:
Mathis 2026-09-20 19:14:23 +02:00
parent 4d2be145aa
commit 9312be91fd

View file

@ -1,4 +1,5 @@
import contextlib
import logging
import discord
from discord import app_commands
@ -27,6 +28,7 @@ class CategorySelect(discord.ui.Select):
)
async def callback(self, interaction: discord.Interaction):
try:
category_key = self.values[0]
categories = cfg.get_categories()
cat = categories.get(category_key, {})
@ -47,6 +49,10 @@ class CategorySelect(discord.ui.Select):
return
await interaction.response.send_modal(TicketModal(category_key, cat.get("name", category_key)))
except Exception as e:
logging.getLogger("vision").error(f"CategorySelect callback error: {e}", exc_info=True)
if not interaction.response.is_done():
await interaction.response.send_message(f"Erreur interne: `{e}`", ephemeral=True)
class TicketModal(discord.ui.Modal, title="Nouveau Ticket"):
@ -444,7 +450,7 @@ class ModMail(commands.Cog):
open_button = discord.ui.Button(
label=f"Ouvrir — {cat['name']}",
style=discord.ButtonStyle.primary,
custom_id=f"modmail_quick_open:{key}",
custom_id="modmail_quick_open",
)
container.add_item(discord.ui.ActionRow(open_button))