☃Alex<33🎄
☃Alex<33🎄
DIAdiscord.js - Imagine an app
Created by ☃Alex<33🎄 on 9/28/2024 in #djs-questions
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:
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.0 Discord.js version: [email protected]
32 replies
DIAdiscord.js - Imagine an app
Created by ☃Alex<33🎄 on 9/14/2024 in #djs-questions
Reaction Collector doesn't work as intended
So the code for reaction collector doesn't work, i was following a tutorial and i rechecked every single line a few times still doesn't work as intended.
const { SlashCommandBuilder } = require(`discord.js`);

module.exports = {
data: new SlashCommandBuilder()
.setName(`reactor`)
.setDescription(`Returns reactions`),

async execute(interaction, client) {
const message = await interaction.reply({
content: `React here!`,
fetchReply: true,
});

const emoji = client.emojis.cache.find(
(emoji) => emoji.id == `1284587267565944922`
);

message.react(emoji);
message.react(":white_check_mark:");

const filter = (reaction, user) => {
return reaction.emoji.name == ":white_check_mark:" && user.id == interaction.user.id;
};

const collector = message.createReactionCollector({ filter, time: 10000 });

collector.on('collect', (reaction, user) => {
console.log(`Collected ${reaction.emoji.name} from ${user.tag}`);
});

collector.on('end', (collected) => {
console.log(`Collected ${collected.size} items`);
});
},
};
const { SlashCommandBuilder } = require(`discord.js`);

module.exports = {
data: new SlashCommandBuilder()
.setName(`reactor`)
.setDescription(`Returns reactions`),

async execute(interaction, client) {
const message = await interaction.reply({
content: `React here!`,
fetchReply: true,
});

const emoji = client.emojis.cache.find(
(emoji) => emoji.id == `1284587267565944922`
);

message.react(emoji);
message.react(":white_check_mark:");

const filter = (reaction, user) => {
return reaction.emoji.name == ":white_check_mark:" && user.id == interaction.user.id;
};

const collector = message.createReactionCollector({ filter, time: 10000 });

collector.on('collect', (reaction, user) => {
console.log(`Collected ${reaction.emoji.name} from ${user.tag}`);
});

collector.on('end', (collected) => {
console.log(`Collected ${collected.size} items`);
});
},
};
it does not throw any errors, but it collects 0 reactions, Thanks in Advance! Node.js version: v20.17.0 Discord.js version: 14.16.1
14 replies