From 32513485c3818a35c7441ad3a3b8c7cbd1231671 Mon Sep 17 00:00:00 2001 From: Mathis Date: Sat, 19 Sep 2026 15:30:34 +0200 Subject: [PATCH] fix(modmail): correct attachment handling + include initial message in transcript - Fix discord.File.from_attachment (nonexistent) -> Attachment.to_file() - Record initial ticket reason into transcript history --- commandes/modmail.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/commandes/modmail.py b/commandes/modmail.py index 5872a86..c5516b4 100644 --- a/commandes/modmail.py +++ b/commandes/modmail.py @@ -105,6 +105,18 @@ class TicketModal(discord.ui.Modal, title="Nouveau Ticket"): await _send_ticket_panel(ticket_channel, interaction.user, self.category_name, self.reason.value) + cog = interaction.client.get_cog("ModMail") + if cog is not None: + cog._dm_messages.setdefault(interaction.user.id, []).append( + { + "author": interaction.user, + "content": self.reason.value, + "timestamp": discord.utils.utcnow(), + "attachments": [], + "is_staff": False, + } + ) + with contextlib.suppress(discord.HTTPException): await interaction.followup.send( f"Ticket cree: {ticket_channel.mention}", @@ -520,7 +532,7 @@ class ModMail(commands.Cog): await channel.send(embed=embed) for att in message.attachments: - await channel.send(file=await discord.File.from_attachment(att)) + await channel.send(file=await att.to_file()) # --- COMMANDES ---