ircbot: configure a sleep before autojoin channels

This commit is contained in:
Brian S. Stephan 2015-06-16 19:01:41 -05:00
parent aca4ed3eac
commit f0072fb633
2 changed files with 9 additions and 0 deletions

View File

@ -131,6 +131,10 @@ IRCBOT_SSL = False
IRCBOT_IPV6 = False
# post-connect, pre-autojoin stuff
IRCBOT_SLEEP_BEFORE_AUTOJOIN_SECONDS = 10
# XML-RPC settings
IRCBOT_XMLRPC_HOST = 'localhost'
IRCBOT_XMLRPC_PORT = 13132

View File

@ -12,6 +12,7 @@ import socket
import ssl
import sys
import thread
import time
from django.conf import settings
@ -468,6 +469,10 @@ class IRCBot(irc.client.SimpleIRCClient):
log.debug("welcome: %s", what)
# sleep before doing autojoins
time.sleep(settings.IRCBOT_SLEEP_BEFORE_AUTOJOIN_SECONDS)
for chan in IrcChannel.objects.filter(autojoin=True):
log.info(u"autojoining %s", chan.name)
self.connection.join(chan)