Bot not allowing me to do announcments

When i do a announcment command it just says "failed to respond" or like "unable to do this command"
5 Replies
d.js toolkit
d.js toolkit2mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Mr Foley
Mr FoleyOP2mo ago
just does this
Mr Foley
Mr FoleyOP2mo ago
No description
Mr Foley
Mr FoleyOP2mo ago
No description
Mr Foley
Mr FoleyOP2mo ago
mainly chat gpt tbh as just needed basic commands this is the code: // Define commands const commands = [ // ... other commands ... new SlashCommandBuilder() .setName('announcement') .setDescription('Send an announcement to the channel.') .addStringOption(option => option.setName('title') .setDescription('Custom title for the announcement') .setRequired(true)) .addStringOption(option => option.setName('description') .setDescription('Description of the announcement') .setRequired(true)) .addBooleanOption(option => option.setName('ping_everyone') .setDescription('Should it ping everyone?') .setRequired(false)), ].map(command => command.toJSON()); // Event handler for slash commands client.on('interactionCreate', async interaction => { if (!interaction.isCommand()) return; const { commandName, options } = interaction; try { // ... existing command logic ...
if (commandName === 'announcement') { const title = options.getString('title'); const description = options.getString('description'); const pingEveryone = options.getBoolean('ping_everyone'); const embed = { title: title, description: description, color: 0x00AE86, // Teal color for the embed timestamp: new Date(), footer: { text: Announcement made by ${interaction.user.tag}, }, }; // Send the announcement await interaction.reply({ content: pingEveryone ? '@everyone' : '', embeds: [embed] }); }
} catch (err) { console.error(err); await interaction.reply('There was an error processing your command.'); } });
Want results from more Discord servers?
Add your server