Some issue with the code that doesn't allow the creation of slash command error code 400
discord.js slash command
29 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 error
Also, you need to specify the type with the correct enum
which is ApplicationCommandOptionType
?
sadly i work on mobile so will a screenshot do?
Your 'type' property needs to be an enum
Not a string
Also dont deploy your commands on every start, use a deploy script
so number 3
rate limit issues?
It might get your ratelimited yes
I dont know, hence why i say use the enum
wait so when deployed does it automatically work with other server if deployed once
like global
If you use the global route, yes
ah i see
do u need logs or no?
Not atm because the 400 is likely due to your incorrect type, if it persists, then yes
yes the error return the type is 0
did you use the enum
yes
bruh
it works
oh wrong script
i used the index.js instead of bot.js
lol
node . becomes to comfortable
nope error
you should just have to run node deploy-commands.js
Show it
that would require me to take out the deployment code
thats what the script is indeed made for
to not run at every start
show your updated code
And i dont see you using the enum, rather a string
yeah use the enum or actual numbers
i did didn't i?
No, thats a string
oh i see
that's wh
Just use ApplicationCommandOptionType.String, or just 3 without '', if you can remember the types from memory
it works 0-0
i read the docs
but i didn't know '' was the cause
welp it's time for me to come clean
i used chatgpt
ok it's solved
well if the code 99% works it ok
that does explain your issue
Never ever use chatgpt for djs
It uses data from 2021
i am surprised the flag didn't cause any issues cause it has been
Instead learn actual js instead of asking chatgpt