Michael-J-Scofield / discord-anti-spam

A simple discord anti spam node.js module to prevent spam on your discord server
MIT License
147 stars 53 forks source link

Error when the bot deletes spam. #128

Closed DangoTV closed 3 years ago

DangoTV commented 3 years ago

Greetings,

First I wanna say thank you for adding the feature I requested about 2 years ago, just noticed honestly <3: https://github.com/Michael-J-Scofield/discord-anti-spam/issues/72

The issue I'm getting with the most recent version is the following:

`Mon#1454 has been warned.

Mon#1454 has been kicked.

(node:18540) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message at RequestHandler.execute (C:\Users\Senpai\Desktop\MikoBot\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:89:5) at async RequestHandler.push (C:\Users\Senpai\Desktop\MikoBot\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
at async MessageManager.delete (C:\Users\Senpai\Desktop\MikoBot\node_modules\discord.js\src\managers\MessageManager.js:126:5) (node:18540) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:18540) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`

Essentially what happens is that whenever a user is punished(warn/kick/ban), I have it set to delete his past messages that are considered as spam. However, the bot cannot do the actions fast enough and it returns this error. The messages eventually do get deleted but this error prints a couple of times in the console before that happens.

Just figured I'd point it out, it doesn't break the bot in the least but it's still something to consider.

Thanks for your time as always! Best regards, Dango#0001

Scraayp commented 3 years ago

No problem for adding your request!

And are you using the removeMessages option?

DangoTV commented 3 years ago

Yes, it should be set as true by default since I didn’t personally write any code that deletes the messages.

Scraayp commented 3 years ago

DiscordAPIError: Unknown Message

Why: The removemessages function tries to delete an message which is not aviable by the discord api Fix: Disable verbose (extended error logging). verbose: false in the options.