File uploads will now be sent as attachments
This commit is contained in:
+1
-1
@@ -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",
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user