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
d.js toolkit
d.js toolkit11mo 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!
treble/luna
treble/luna11mo ago
Show your code In a pastebin
d.js docs
d.js docs11mo ago
To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
grass
grass11mo ago
command doesn’t appear to exist
are you deploying your commands
d.js docs
d.js docs11mo ago
guide Creating Your Bot: Registering slash commands read more
treble/luna
treble/luna11mo ago
i'm pretty sure they just didnt listen to what i told them in their previous post
Fisch
FischOP11mo ago
I did I couldn't get it to work
treble/luna
treble/luna11mo ago
Then show your code
d.js docs
d.js docs11mo ago
To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
Fisch
FischOP11mo ago
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('');
treble/luna
treble/luna11mo ago
you literally just added a builder again Read the guide Dont ask ai
Fisch
FischOP11mo ago
I didn't
treble/luna
treble/luna11mo ago
I do not get how lany times i have to tell you that
d.js docs
d.js docs11mo ago
guide Home: What's new read more
Fisch
FischOP11mo ago
I didn't I used the guide
treble/luna
treble/luna11mo ago
You did not That code is not from the guide
Fisch
FischOP11mo ago
It is
treble/luna
treble/luna11mo ago
It is not
Fisch
FischOP11mo ago
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'));
treble/luna
treble/luna11mo ago
That part ks
Fisch
FischOP11mo ago
It's from there
treble/luna
treble/luna11mo ago
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
Want results from more Discord servers?
Add your server