commit 309961b4e9db540b114b3cb05e835d875de80746
parent dc8bb7be3c83552a587fbe28845f5eefefdc8b4c
Author: knutsen <samuel@knutsen.co>
Date: Sun, 30 May 2021 21:23:29 +0100
Ignore spam detection on trigger command.
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/main.ts b/lib/main.ts
@@ -346,16 +346,20 @@ export abstract class SimpOMatic {
// Only give spam warning if commands are coming
// fast _in the same channel_.
const delta = current_command.createdTimestamp - last_command.createdTimestamp;
+ // Be a bit stricter if the command is *the exact same*.
if (last_command.content === current_command.content
&& delta <= 1400) {
+ console.log("[command] Very much spam.");
if (delta <= 400) return;
- return message.reply(`I can't help but notice you're running \
+ message.reply(`I can't help but notice you're running \
the same commands over in rather rapid succession.
Would you like to slow down a little?`.squeeze());
+ return;
}
if (delta <= 900) {
+ console.log("[command] Very much spam.");
if (delta <= 300) return;
- return message.reply('Slow down there bucko.');
+ message.reply('Slow down there bucko.');
}
}
}
@@ -506,7 +510,7 @@ Would you like to slow down a little?`.squeeze());
// Send it back as a command.
this.on_message([message],
SimpOMatic._CLIENT,
- null, false,
+ null, true, // Ignore 'spam' since time-delta = 0.
true); // Ignore author constraints = true.
}
}