Add disabled-by-default start spam killer

Like the color/bold killers, this can be configured to kick people if
they spam !start while it is being ratelimited for them.
This commit is contained in:
skizzerz 2016-02-01 17:32:02 -06:00
parent f3a7be45d4
commit 6738acc82c
3 changed files with 17 additions and 3 deletions

View File

@ -218,6 +218,8 @@
"notice_no_bold": "Using bold in the channel is not allowed.",
"kick_color": "{0} {1} :Using color is not allowed",
"notice_no_color": "Using color in the channel is not allowed.",
"startspam_warn": "{0}: Spamming the start command is not allowed.",
"startspam_kick": "{0} {1} :Spamming the start command is not allowed.",
"goat_fail": "This can only be done once per day.",
"not_enough_parameters": "Not enough parameters.",
"goat_target_not_in_channel": "\u0002{0}\u0002 is not in this channel.",

View File

@ -120,8 +120,12 @@ MAD_SCIENTIST_SKIPS_DEAD_PLAYERS = 16
CARE_BOLD = False
CARE_COLOR = False
CARE_STARTSPAM = False
CARE_STARTSPAM_LIMIT = 3
KILL_COLOR = False
KILL_BOLD = False
KILL_STARTSPAM = False
KILL_STARTSPAM_LIMIT = 4
# HIT MISS SUICIDE HEADSHOT
GUN_CHANCES = ( 5/7 , 1/7 , 1/7 , 2/5 )

View File

@ -7264,9 +7264,17 @@ def start_cmd(cli, nick, chan, rest):
def start(cli, nick, chan, forced = False, restart = ""):
if (not forced and var.LAST_START and nick in var.LAST_START and
var.LAST_START[nick] + timedelta(seconds=var.START_RATE_LIMIT) >
var.LAST_START[nick][0] + timedelta(seconds=var.START_RATE_LIMIT) >
datetime.now() and not restart):
cli.notice(nick, messages["command_ratelimited"])
var.LAST_START[nick][1] += 1
if (var.CARE_STARTSPAM and var.KILL_STARTSPAM and
var.LAST_START[nick][1] >= var.KILL_STARTSPAM_LIMIT):
cli.send("KICK " + messages["startspam_kick"].format(botconfig.CHANNEL, nick))
elif var.CARE_STARTSPAM and var.LAST_START[nick][1] >= var.CARE_STARTSPAM_LIMIT:
cli.msg(chan, messages["startspam_warn"].format(nick))
cli.notice(nick, messages["command_ratelimited"])
else:
cli.notice(nick, messages["command_ratelimited"])
return
if restart:
@ -7276,7 +7284,7 @@ def start(cli, nick, chan, forced = False, restart = ""):
return
if not restart:
var.LAST_START[nick] = datetime.now()
var.LAST_START[nick] = [datetime.now(), 1]
if chan != botconfig.CHANNEL:
return