From 27117ae53e0bc05a16b1f581e89fab8363cf899b Mon Sep 17 00:00:00 2001 From: moneromooo Date: Thu, 1 Jan 2015 10:59:56 +0000 Subject: [PATCH] The bot can now be in several channels at once --- tipbot/config.py | 2 +- tipbot/irc.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tipbot/config.py b/tipbot/config.py index 54c93a1..5573616 100644 --- a/tipbot/config.py +++ b/tipbot/config.py @@ -16,7 +16,7 @@ irc_network = 'irc.freenode.net' irc_port = 6697 irc_send_delay = 0.4 irc_welcome_line = 'Welcome to the freenode Internet Relay Chat Network' -irc_homechan = '#txtptest000' +irc_channels = ['#txtptest000'] irc_timeout_seconds = 600 irc_use_ssl = True diff --git a/tipbot/irc.py b/tipbot/irc.py index 872b7db..95ed996 100644 --- a/tipbot/irc.py +++ b/tipbot/irc.py @@ -106,9 +106,6 @@ def connect_to_irc(network,port,name,password,delay): def reconnect_to_irc(): connect_to_irc(irc_network,irc_port,irc_name,irc_password,irc_line_delay) -def Send(msg): - SendIRC ('PRIVMSG ' + config.irc_homechan + ' : ' + msg) - def SendTo(where,msg): SendIRC ('PRIVMSG ' + where + ' : ' + msg) @@ -272,8 +269,9 @@ def IRCLoop(on_idle,on_identified,on_command): userstable = dict() registered_users.clear() SendTo("nickserv", "IDENTIFY %s" % irc_password) - Join(config.irc_homechan) - #ScanWho(None,[config.irc_homechan]) + for chan in config.irc_channels: + Join(chan) + #ScanWho(None,[chan]) if data.find ( 'PING' ) == 0: log_log('Got PING, replying PONG')