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
d.js toolkit
d.js toolkit•10mo ago
- 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!
Squid
Squid•10mo ago
Is the function that times them out this part:
await this.container.util.automodMute(
message.member,
message,
data.length + 1
);
await this.container.util.automodMute(
message.member,
message,
data.length + 1
);
? 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
-Carlos👑
-Carlos👑•10mo ago
which context do you need? I can share util.js if you want yes
Squid
Squid•10mo ago
so the problem is that the following if statement has at least one condition returning true:
if (
data.length + 1 === 3 ||
data.length + 1 === 5 ||
data.length + 1 === 7 ||
data.length + 1 === 8 ||
data.length + 1 === 9
)
if (
data.length + 1 === 3 ||
data.length + 1 === 5 ||
data.length + 1 === 7 ||
data.length + 1 === 8 ||
data.length + 1 === 9
)
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 timeout
-Carlos👑
-Carlos👑•10mo ago
wdym 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