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
- 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!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
Is there a command to do that automatically?
no
What?
show your command handler
well, the command you're trying to run is not being pushed into client.comandos
If not? The folder where all the js are is loaded.
And in that case, how do I load those commands?
also
thats just your deploy file
thats not your command handler
where is your interactionCreate event
And how is it possible that it reads the slash command but then does not execute it?
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
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
did you write that code
Only the functions
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
The order of function parameters must match between definition and function call.
- mismatch! you pass an interaction where the client is expected
- mismatch! you pass the client where an interaction is expected
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.
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 functionIf I modify the handlers, will I be able to start everything?
yes
Ok, I'll get to it, thank you very much for your help.
I make this
But
define it
basic js
also
follow the guide
the above code is invalid
And this code?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.