diff --git a/src/core/discord/psa.ts b/src/core/discord/psa.ts index 5f6d78f7c..42dfe93eb 100644 --- a/src/core/discord/psa.ts +++ b/src/core/discord/psa.ts @@ -6,16 +6,17 @@ export type PSAData = { }[]; commands?: string[]; } & ( + | { + type?: 'embed'; + title: string; + description: string; + image?: string; + } | { type: 'image'; image: string; title?: string; } - | { - type: 'embed'; - title: string; - description: string; - } ); export interface PSA { diff --git a/src/events/interactionCreate/handlers/chatInputCommand.ts b/src/events/interactionCreate/handlers/chatInputCommand.ts index a3208c3a2..6b111128f 100644 --- a/src/events/interactionCreate/handlers/chatInputCommand.ts +++ b/src/events/interactionCreate/handlers/chatInputCommand.ts @@ -63,10 +63,14 @@ export default async function handleChatInputCommand( (psa.data.commands === undefined || psa.data.commands.includes(interaction.commandName)) ) { - if (psa.data.type === 'embed') { + if (psa.data.type === undefined || psa.data.type === 'embed') { if (!reply.embeds) reply.embeds = []; - reply.embeds.push(embedWarning(psa.data.title, psa.data.description)); - } else { + + const embed = embedWarning(psa.data.title, psa.data.description); + + if (psa.data.image) embed.setImage(psa.data.image); + reply.embeds.push(embed); + } else if (psa.data.type === 'image') { if (!reply.files) reply.files = []; reply.files.push(new AttachmentBuilder(psa.data.image)); reply.content = reply.content ?? psa.data.title; @@ -101,12 +105,14 @@ export default async function handleChatInputCommand( ephemeral: true, }; - if (psa.data.type === 'embed') { + if (psa.data.type === undefined || psa.data.type === 'embed') { if (!followUp.embeds) followUp.embeds = []; - followUp.embeds.push( - embedWarning(psa.data.title, psa.data.description), - ); - } else { + + const embed = embedWarning(psa.data.title, psa.data.description); + + if (psa.data.image) embed.setImage(psa.data.image); + followUp.embeds.push(embed); + } else if (psa.data.type === 'image') { if (!followUp.files) followUp.files = []; followUp.files.push(new AttachmentBuilder(psa.data.image)); followUp.content = followUp.content ?? psa.data.title;