Automod System
so yesterday I was making an automod system and I realized this:
If a user reaches 3 auto warnings, gets auto timeouted, then I manually untimeout them, then that person says anything (anything, even if the word in not in the array of bannedWords) the bot will timeout them like if they had 5 auto warnings
code:
https://pastebin.com/cy6T1Re2
Pastebin Password: TL8PytN6tj
5 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!Is the function that times them out this part:
?
If so, that's being called completely separate from and before checking if the person said any banned words
When it comes to unintentionally adding an auto warning, that's hard to tell from your bin since your functions and logic seem obfuscated
It's not necessarily bad, but it's hard for us to help since we're missing most of the context needed
which context do you need?
I can share util.js if you want
yes
so the problem is that the following
if
statement has at least one condition returning true:
I assume it's the second one since if data.length + 1 === 5
, then data.length === 4
, which would be the 3 auto warnings and the 1 auto timeoutwdym
anyone?
fixed the part where it timeouts them for saying anything
however it still timeouts them for 4 hours (the 5 auto warn punishment) when they should only have 4