Skip to content Skip to sidebar Skip to footer

Discord Bot Still Answering Multiple Times On One Event

Already found same issue, but there are no answer there :C So my problem is same, using Discord.js lib, and this is my code: client.on('message', msg => { var splittedMess

Solution 1:

The event message is triggered on all messages, even the ones the bot sends :

Emitted whenever a message is created.

https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-message

So you are continually triggering the event by sending a message.

The solution is to always check for the author, if it is different than the bot itself (the bot-user property is bot.user : https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=user)


Solution 2:

First if you are using Visual Studio Code you can run multiple instances of the same program/bot. the terminal in Visual Studio Code:
the terminal in Visual Studio Code

So each time you edit then start the script it will create a "new" terminal (so another instance). where these instances are located:
where these instances are located

So then press the recycle button (next to the drop down menu) on all of the instances. Then start the script again - it should be fine.


Post a Comment for "Discord Bot Still Answering Multiple Times On One Event"