Why is my Discord bot not working on Node.js?
The bot starts, but does not respond to !ping and !sum.
7 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!
- ✅
Marked as resolved by OPErrors?
discord.js - 14.13.0
Node.js - v21.1.0
No errors
you missed the MessageContent intent, because you didn't have the intent, everytime ur bot receive a messageCreate event,
<Message>.content
will always be an empty string, and stuck at if(!message.content.startsWith(prefix)) return;
btw, #rules 2pls send corrected code
just add the MessageContent intent in your client intents like how you add the Guilds and GuildMessages intent
Thanks!