The bot does not read the command although it does appear in the slash bar

Hello, I am creating commands for my bot, but I do not know what happens that although the code is 100% right, there is no error and even let me put the command and information, when sending the message tells me the bot that the command does not exist. I need someone to help me urgently please.
36 Replies
d.js toolkit
d.js toolkit10mo 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!
SorNion
SorNion10mo ago
treble/luna
treble/luna10mo ago
wherever you push your commands in presumably client.commands, you arent pushing that command also remove the packages that use outdated discord.js version and update
SorNion
SorNion10mo ago
Is there a command to do that automatically?
treble/luna
treble/luna10mo ago
no
SorNion
SorNion10mo ago
What?
treble/luna
treble/luna10mo ago
show your command handler
SorNion
SorNion10mo ago
treble/luna
treble/luna10mo ago
well, the command you're trying to run is not being pushed into client.comandos
SorNion
SorNion10mo ago
If not? The folder where all the js are is loaded. And in that case, how do I load those commands?
SorNion
SorNion10mo ago
treble/luna
treble/luna10mo ago
also thats just your deploy file thats not your command handler
SorNion
SorNion10mo ago
treble/luna
treble/luna10mo ago
where is your interactionCreate event
SorNion
SorNion10mo ago
And how is it possible that it reads the slash command but then does not execute it?
SorNion
SorNion10mo ago
treble/luna
treble/luna10mo ago
because you dont do it not in that part of the code well that expects your command to export a run function yours has an execute function which isnt even being reached as its not present in your client.commandos
SorNion
SorNion10mo ago
How do I fix that? I haven't been doing this for a long time and I don't really know much about it. Can each js be loaded one by one? By a list
treble/luna
treble/luna10mo ago
did you write that code
SorNion
SorNion10mo ago
Only the functions
treble/luna
treble/luna10mo ago
yeah so please take the time to familiarize yourself with js first djs requires a strong js understanding as for your issues, i listed above one more issue is that you call your function with 2 params, client and interaction but your actual command file only has one, named interaction, which will be your client
d.js docs
d.js docs10mo ago
The order of function parameters must match between definition and function call.
function execute(client, interaction) { ... };
execute(interaction, client);
function execute(client, interaction) { ... };
execute(interaction, client);
- mismatch! you pass an interaction where the client is expected - mismatch! you pass the client where an interaction is expected
SorNion
SorNion10mo ago
But I still don't understand why I can't read the js file of the command, in this case called "poll". With the interaction I should be able to start all of them.
treble/luna
treble/luna10mo ago
read what i said your command exports an execute function your command handler calls a run function and your command is only partially being pushed into your comandos namely just the data , not your execute function
SorNion
SorNion10mo ago
If I modify the handlers, will I be able to start everything?
treble/luna
treble/luna10mo ago
yes
SorNion
SorNion10mo ago
Ok, I'll get to it, thank you very much for your help.
SorNion
SorNion10mo ago
SorNion
SorNion10mo ago
I make this But
SorNion
SorNion10mo ago
treble/luna
treble/luna10mo ago
define it basic js also
d.js docs
d.js docs10mo ago
guide Creating Your Bot: Command handling read more
treble/luna
treble/luna10mo ago
follow the guide the above code is invalid
SorNion
SorNion10mo ago
And this code?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
entropy
entropy9mo ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Want results from more Discord servers?
Add your server
More Posts