From 445ca1b10b30ea2ce5b434b11339ef47396e17cd Mon Sep 17 00:00:00 2001 From: hgw Date: Sun, 8 Oct 2023 01:48:26 +0000 Subject: [PATCH] Togglable flood commands --- bot.js | 21 ++++++++++++--------- config/example.config.json | 3 ++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bot.js b/bot.js index 29ba8f3..2d0e1fe 100644 --- a/bot.js +++ b/bot.js @@ -105,17 +105,9 @@ bot.addListener('message', function(nick, to, text, from) { var command = args[0].toLowerCase() if (args[0] === '$help') { help(to); - } else if (command === config.irc.prefix+'flood') { - flood(to, args) } else if (command === config.irc.prefix+'sneed') { sneed(to); - } else if (command === config.irc.prefix+'ctcpflood') { - ctcp(args[1], args[2], args[3]); - } else if (command === config.irc.prefix+'rspam') { - rspam(to, args[1]) - } else if (command === config.irc.prefix+'uspam') { - uspam(to, args[1]); - } else if (command === config.irc.prefix+'art') { + } else if (command === config.irc.prefix+'art') { art(to, args[1]); } else if (command === config.irc.prefix+'godwords') { godwords(to, args[1]); @@ -124,6 +116,17 @@ bot.addListener('message', function(nick, to, text, from) { } else if (command === config.irc.prefix+'symphish') { symphish(to, args[1], args[2]) } + if (config.floodprotect.enable_flood_commands == "true") { + if (command === config.irc.prefix+'flood') { + flood(to, args) + } else if (command === config.irc.prefix+'ctcpflood') { + ctcp(args[1], args[2], args[3]); + } else if (command === config.irc.prefix+'rspam') { + rspam(to, args[1]) + } else if (command === config.irc.prefix+'uspam') { + uspam(to, args[1]); + } + } msgTimeout.add(to); setTimeout(() => { msgTimeout.delete(to); diff --git a/config/example.config.json b/config/example.config.json index b088362..83d8d31 100644 --- a/config/example.config.json +++ b/config/example.config.json @@ -15,7 +15,8 @@ "floodprotect": { "flood_protection": "false", "flood_protection_delay": "0", - "command_listen_timeout": "2500" + "command_listen_timeout": "2500", + "enable_flood_commands": "true" }, "errorhandling": { "error_logging": "true",