Skip to content
Advertisement

Discord.js error message on deleting Bot message

So basically I am lately always getting the following Error when I delete a message that my Bot sends. The message is not being used by the Bot anymore, but for some reason, it always crashes after deletion.

JavaScript

Here is the Code for the command where it always has the problems with:

JavaScript

As you see I never actually want to edit any of my messages, that I send out with the bot.

Advertisement

Answer

Your problem is that you delete the message twice. The first time you delete it right at the start of the command, the second time in the case: "patrol". So I would recommend you to only delete it in the switch/case, because in the default branch you want to reply to the message. This will be your code then (I just removed one line):

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement