From e652a8156c02f81683bef5cf21a8d4b530dc167d Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 25 Apr 2018 00:14:37 +0200 Subject: [PATCH] use the builtin anti flood stuff in irc3 rather than a crude time.sleep() --- src/ircbot/irc3module.py | 4 ---- src/ircbot/ircworker.py | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ircbot/irc3module.py b/src/ircbot/irc3module.py index 3ef7c761..bd6e386d 100644 --- a/src/ircbot/irc3module.py +++ b/src/ircbot/irc3module.py @@ -5,7 +5,6 @@ from django.conf import settings from django.utils import timezone from events.models import Routing from teams.utils import get_team_from_irc_channel -import time import logging logger = logging.getLogger("bornhack.%s" % __name__) @@ -302,9 +301,6 @@ class Plugin(object): # also add autoinvite for this username self.bot.mode(channel, '+I', '$a:%s' % username) - # add a delay so the bot doesn't flood itself off - time.sleep(1) - @irc3.extend def fix_missing_acls(self): diff --git a/src/ircbot/ircworker.py b/src/ircbot/ircworker.py index f3864d8d..5e5fb8d2 100644 --- a/src/ircbot/ircworker.py +++ b/src/ircbot/ircworker.py @@ -21,6 +21,9 @@ def do_work(): 'port': settings.IRCBOT_SERVER_PORT, 'ssl': settings.IRCBOT_SERVER_USETLS, 'timeout': 30, + 'flood_burst': 2, + 'flood_rate': 1, + 'flood_rate_delay': 2, 'includes': [ 'ircbot.irc3module', ],