diff --git a/modules/wolfgame.py b/modules/wolfgame.py index d956912..b51a1ca 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -63,6 +63,7 @@ var.LAST_ADMINS = None var.LAST_GSTATS = None var.LAST_PSTATS = None var.LAST_TIME = None +var.LAST_START = {} var.USERS = {} @@ -5486,6 +5487,14 @@ def fstart(cli, nick, chan, rest): start(cli, nick, chan) def start(cli, nick, chan, forced = False): + if (var.LAST_START and nick in var.LAST_START and var.LAST_START[nick] + + timedelta(seconds=var.START_RATE_LIMIT) > datetime.now()): + cli.notice(nick, ("This command is rate-limited. Please wait a while " + "before using it again.")) + return + + var.LAST_START[nick] = datetime.now() + if chan != botconfig.CHANNEL: return diff --git a/settings/wolfgame.py b/settings/wolfgame.py index 37f5e74..f067cda 100644 --- a/settings/wolfgame.py +++ b/settings/wolfgame.py @@ -13,6 +13,7 @@ ADMINS_RATE_LIMIT = 300 GSTATS_RATE_LIMIT = 0 PSTATS_RATE_LIMIT = 0 TIME_RATE_LIMIT = 10 +START_RATE_LIMIT = 10 # (per-user) SHOTS_MULTIPLIER = .12 # ceil(shots_multiplier * len_players) = bullets given SHARPSHOOTER_MULTIPLIER = 0.06 MIN_PLAYERS = 4