ircbot: specify commands after connecting

happens before the sleep and the autojoins
This commit is contained in:
Brian S. Stephan 2015-06-16 19:02:00 -05:00
parent f0072fb633
commit bef66e3427
2 changed files with 6 additions and 0 deletions

View File

@ -133,6 +133,7 @@ IRCBOT_IPV6 = False
# post-connect, pre-autojoin stuff
IRCBOT_SLEEP_BEFORE_AUTOJOIN_SECONDS = 10
IRCBOT_POST_CONNECT_COMMANDS = [ ]
# XML-RPC settings

View File

@ -469,6 +469,11 @@ class IRCBot(irc.client.SimpleIRCClient):
log.debug("welcome: %s", what)
# run automsg commands
for cmd in settings.IRCBOT_POST_CONNECT_COMMANDS:
# TODO NOTE: if the bot is sending something that changes the vhost
# (like 'hostserv on') we don't pick it up
self.connection.privmsg(cmd.split(' ')[0], ' '.join(cmd.split(' ')[1:]))
# sleep before doing autojoins
time.sleep(settings.IRCBOT_SLEEP_BEFORE_AUTOJOIN_SECONDS)