diff --git a/messages/en.json b/messages/en.json index 4bb7112..df4b09e 100644 --- a/messages/en.json +++ b/messages/en.json @@ -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.", diff --git a/src/settings.py b/src/settings.py index 05ed28b..434d09c 100644 --- a/src/settings.py +++ b/src/settings.py @@ -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 ) diff --git a/src/wolfgame.py b/src/wolfgame.py index 44c552b..7b54e0b 100644 --- a/src/wolfgame.py +++ b/src/wolfgame.py @@ -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