Allow sending attachment

This commit is contained in:
Supositware 2022-09-14 11:30:45 +02:00
parent 1eb3b8a013
commit 226ae3b096

View file

@ -10,7 +10,11 @@ export default {
.addStringOption(option => .addStringOption(option =>
option.setName('feedback') option.setName('feedback')
.setDescription('The message you want to send me.') .setDescription('The message you want to send me.')
.setRequired(true)), .setRequired(true))
.addAttachmentOption(option =>
option.setName('image')
.setDescription('Optional attachment.')
.setRequired(false)),
category: 'utility', category: 'utility',
async execute(interaction, args) { async execute(interaction, args) {
const Embed = new EmbedBuilder() const Embed = new EmbedBuilder()
@ -27,7 +31,12 @@ export default {
} }
const channel = interaction.client.channels.resolve(feedbackChannelId); const channel = interaction.client.channels.resolve(feedbackChannelId);
if (args.image) {
channel.send({ embeds: [Embed], files: [args.image] });
}
else {
channel.send({ embeds: [Embed] }); channel.send({ embeds: [Embed] });
}
await interaction.reply({ content: 'Your feedback has been sent! Don\'t forget to have dm open if you want to get an answer from the dev!', ephemeral: true }); await interaction.reply({ content: 'Your feedback has been sent! Don\'t forget to have dm open if you want to get an answer from the dev!', ephemeral: true });
}, },
}; };