From 97a7a966c8da4f86e3209150bafb61c1bef22490 Mon Sep 17 00:00:00 2001 From: DJj123dj <80536295+DJj123dj@users.noreply.github.com> Date: Mon, 1 Jun 2026 19:14:08 +0200 Subject: [PATCH] File uploads will now be sent as attachments --- package.json | 2 +- src/actions/createTicket.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9c57d66..dff5911 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "license": "GPL-3.0-only", "dependencies": { "@discordjs/rest": "^2.6.1", - "@open-discord-bots/framework": "^2.0.0", + "@open-discord-bots/framework": "^2.0.2", "@types/node": "^22.5.0", "@types/terminal-kit": "^2.5.7", "ansis": "^4.2.0", diff --git a/src/actions/createTicket.ts b/src/actions/createTicket.ts index c8ff9ca..eaa0cf0 100644 --- a/src/actions/createTicket.ts +++ b/src/actions/createTicket.ts @@ -194,8 +194,18 @@ export async function registerActions(){ //pin ticket message (if required) if (generalConfig.data.ticketSystem.pinFirstTicketMessage && ticketMsg.pinnable) await ticketMsg.pin("Ticket Message") + //send modal file upload answers in separate message to prevent deletion after 72h + const attachments = answers + .filter((answer) => answer.type == "file-upload") + .map((answer) => answer.files).flat() + .map((file) => new discord.AttachmentBuilder(file.url,{ + name:file.name, + description:file.description ?? undefined + })) + if (attachments.length > 0) await channel.send({files:attachments}) + //manage stats - await opendiscord.statistics.get("opendiscord:ticket").setStat("opendiscord:messages-sent",ticket.id.value,1,"increase") + await opendiscord.statistics.get("opendiscord:ticket").setStat("opendiscord:messages-sent",ticket.id.value,2,"increase") await opendiscord.events.get("afterTicketMainMessageCreated").emit([ticket,ticketMsg,channel,user]) }catch(err){