Code is working but command isn't
So the code works, and the bot is online, but the command just doesn't appear to exist
22 Replies
- 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!Show your code
In a pastebin
command doesn’t appear to existare you deploying your commands
i'm pretty sure they just didnt listen to what i told them in their previous post
I did
I couldn't get it to work
Then show your code
const { SlashCommandBuilder } = require('discord.js');
const data = new SlashCommandBuilder()
.setName('echo')
.setDescription('Replies with your input!')
.addStringOption(option =>
option.setName('input')
.setDescription('The input to echo back'));
client.once('ready', () => {
console.log('Bot is online!');
});
client.on('messageCreate', (message) => {
if (message.author.bot) return;
if (message.content.startsWith(PREFIX) && message.guild) {
const [command, ...args] = message.content.slice(PREFIX.length).trim().split(/ +/);
if (command === 'poll') {
if (!message.member.permissions.has('MANAGE_MESSAGES')) {
return message.reply('You do not have permission to create polls.');
}
const pollQuestion = args.join(' ');
if (!pollQuestion) {
return message.reply('Please provide a question for the poll.');
}
message.channel.send(
**Poll:** ${pollQuestion}
).then((pollMessage) => {
pollMessage.react('1️⃣'); // Option 1
pollMessage.react('2️⃣'); // Option 2
});
}
}
});
client.on('messageReactionAdd', (reaction, user) => {
if (user.bot) return;
const message = reaction.message;
if (message.content.startsWith('Poll:')) {
const emoji = reaction.emoji.name;
if (emoji === '1️⃣') {
message.channel.send(${user.username} voted for Option 1!
);
} else if (emoji === '2️⃣') {
message.channel.send(${user.username} voted for Option 2!
);
}
}
});
client.login('');you literally just added a builder
again
Read the guide
Dont ask ai
I didn't
I do not get how lany times i have to tell you that
I didn't
I used the guide
You did not
That code is not from the guide
It is
It is not
const { SlashCommandBuilder } = require('discord.js');
const data = new SlashCommandBuilder()
.setName('echo')
.setDescription('Replies with your input!')
.addStringOption(option =>
option.setName('input')
.setDescription('The input to echo back'));
That part ks
It's from there
Your other code is outsated
And doesnt work for slash commands
Literally just follow the guide
Dont follow a part from it thinking it will magically work