diff --git a/interactions/commands/add.js b/interactions/commands/add.js index 8fee942..7ad79dc 100644 --- a/interactions/commands/add.js +++ b/interactions/commands/add.js @@ -20,9 +20,10 @@ const execute = async (interaction, db, client) => { const attachments = []; for (let i = 1; i <= 4; i++) { const attachment = interaction.options.getAttachment(`attachment${i}`); + const fileExt = attachment.name ? path.extname(attachment.name) : ''; if (attachment) { const url = attachment.url; - const filename = `${user.id}-${i}`; + const filename = `${user.id}-${i}${attachment}.${fileExt}`; const filepath = path.join(__dirname, '../../storage', filename); // Await the download before continuing