From 85046a82773fa660b43eebe2c3e33ef80c7ffc55 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 24 Jul 2010 12:59:51 -0500 Subject: [PATCH] move channel autojoin into a separate section, load it differently --- dr.botzo.cfg | 4 +++- dr.botzo.py | 13 ++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dr.botzo.cfg b/dr.botzo.cfg index 3e77d22..6dd3604 100644 --- a/dr.botzo.cfg +++ b/dr.botzo.cfg @@ -1,7 +1,6 @@ [IRC] server = irc.foonetic.net port = 6667 -channel = #bss nick = dr_devzo name = dr. devzo @@ -11,3 +10,6 @@ debug = true [admin] userhost = bss@ayu.incorporeal.org + +[channels] +autojoin = #bss diff --git a/dr.botzo.py b/dr.botzo.py index bc699dc..9726575 100755 --- a/dr.botzo.py +++ b/dr.botzo.py @@ -18,10 +18,14 @@ def on_connect(connection, event): connection.mode(nick, usermode) except NoOptionError: pass - # join the specified channel - # TODO: support multiple - if irclib.is_channel(channel): - connection.join(channel) + # join the specified channels + try: + autojoins = config.get('channels', 'autojoin').split(',') + for channel in autojoins: + if irclib.is_channel(channel): + connection.join(channel) + except NoOptionError: pass + ##### # on_privmsg # private messages to the bot @@ -59,7 +63,6 @@ try: # load connection info server = config.get('IRC', 'server') port = config.getint('IRC', 'port') - channel = config.get('IRC', 'channel') nick = config.get('IRC', 'nick') ircname = config.get('IRC', 'name') except NoSectionError as e: