My code looks correct, but my bot is no longer detecting messages.
Hello, (I'm French but not bilingual, so sorry in advance if my english isnt good) I created a Discord bot for my server, I'm working with node.js. It was working fine until I added the part "client.on ('guildMemberUpdate'... and the Intents. Maybe it's not related at all. I'm new to coding.
My bot is online but it no longer has its statuses, and it doesn't react at all to messages. Usually I can see when a message is received in the console, but now NOTHING. I only have the confirmation that its online "Congratulations, the Captain has been initialized correctly."
Here is the entire code of the main file index.js in a screenshot or in https://pastebin.com/ejfpnDd5 :
(discord.js version : 14.13.0)
Pastebin
// Dépendancesconst fs = require('fs');const { Client, GatewayInten...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
4 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 OP[email protected]
node v18.18.0
The event for a new message has been changed to
messageCreate
in v14
And you don't have the required intents to get guildMemberUpdate
Ok thanks
I've replaced the relevant part with
client.on('messageCreate'
and added GatewayIntentBits.GuildMembers
to the intents to enable the event
and... it doesn't change anything. My bot doesn't respond and the statuses don't show up
Oh wait...
Now it detects the commands but I get an error code
I've fixed it. Thanks