Mr Foley
Mr Foley
DIAdiscord.js - Imagine an app
Created by Mr Foley on 11/1/2024 in #djs-questions
Bot not allowing me to do announcments
// 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.'); } });
7 replies
DIAdiscord.js - Imagine an app
Created by Mr Foley on 11/1/2024 in #djs-questions
Bot not allowing me to do announcments
mainly chat gpt tbh as just needed basic commands this is the code:
7 replies
DIAdiscord.js - Imagine an app
Created by Mr Foley on 11/1/2024 in #djs-questions
Bot not allowing me to do announcments
No description
7 replies
DIAdiscord.js - Imagine an app
Created by Mr Foley on 11/1/2024 in #djs-questions
Bot not allowing me to do announcments
No description
7 replies
DIAdiscord.js - Imagine an app
Created by Mr Foley on 11/1/2024 in #djs-questions
Bot not allowing me to do announcments
just does this
7 replies