fix(modmail): correct attachment handling + include initial message in transcript
Some checks failed
CI/CD / lint (push) Failing after 43s
CI/CD / test (push) Successful in 42s
CI/CD / deploy (push) Has been skipped
CI/CD / lint (pull_request) Failing after 43s
CI/CD / test (pull_request) Successful in 48s
CI/CD / deploy (pull_request) Has been skipped

- Fix discord.File.from_attachment (nonexistent) -> Attachment.to_file()
- Record initial ticket reason into transcript history
This commit is contained in:
Mathis 2026-09-19 15:30:34 +02:00
parent b736f4cc8b
commit 32513485c3

View file

@ -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 ---