Attachment won't send
Hello everyone, again, so this time i encountered an issue where when i take attachment as an option I cannot output it.
Code:
Node version:
Discord.js version:
Code:
const { SlashCommandBuilder, EmbedBuilder } = require(`discord.js`);
module.exports = {
data: new SlashCommandBuilder()
.setName(`sbapply`)
.setDescription(`Applies for starboard.`)
.addAttachmentOption((option) =>
option
.setName(`image`)
.setDescription(`The image for starboard`)
.setRequired(true)
)
.addStringOption((option) =>
option
.setName(`message`)
.setDescription(`The message to send along side the application`)
),
async execute(interaction, client) {
let message = interaction.options.getString(`message`);
const attachment = interaction.options.getAttachment(`image`);
const channel1 = client.channels.cache.get(`1285686651351334912`);
//const channel2 = client.channels.cache.get(`1284928279832428605`);
if (!message) message = `No message was provided with the application`;
const embed = new EmbedBuilder()
.setTitle(attachment.name)
.setDescription(message)
.setImage(attachment);
await interaction.reply({
content: `Applied successfully`,
embeds: [embed],
ephemeral: true,
});
await channel1.send({
embeds: [embed],
});
},
};const { SlashCommandBuilder, EmbedBuilder } = require(`discord.js`);
module.exports = {
data: new SlashCommandBuilder()
.setName(`sbapply`)
.setDescription(`Applies for starboard.`)
.addAttachmentOption((option) =>
option
.setName(`image`)
.setDescription(`The image for starboard`)
.setRequired(true)
)
.addStringOption((option) =>
option
.setName(`message`)
.setDescription(`The message to send along side the application`)
),
async execute(interaction, client) {
let message = interaction.options.getString(`message`);
const attachment = interaction.options.getAttachment(`image`);
const channel1 = client.channels.cache.get(`1285686651351334912`);
//const channel2 = client.channels.cache.get(`1284928279832428605`);
if (!message) message = `No message was provided with the application`;
const embed = new EmbedBuilder()
.setTitle(attachment.name)
.setDescription(message)
.setImage(attachment);
await interaction.reply({
content: `Applied successfully`,
embeds: [embed],
ephemeral: true,
});
await channel1.send({
embeds: [embed],
});
},
};Node version:
v22.9.0v22.9.0Discord.js version:
discord.js@v14.16.1discord.js@v14.16.1