From 90df8db714286609d2101b0f917bd9ba30ecd07b Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 24 Jul 2010 13:36:13 -0500 Subject: [PATCH] support for manipulating the autojoin list --- dr.botzo.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dr.botzo.py b/dr.botzo.py index 1873ec4..20974b2 100755 --- a/dr.botzo.py +++ b/dr.botzo.py @@ -55,6 +55,22 @@ def on_privmsg(connection, event): connection.quit(' '.join(what.split(' ')[1:])) with open('dr.botzo.cfg', 'w') as cfg: config.write(cfg) + # add/remove channel to/from autojoin list + elif what.split(' ')[0] == 'autojoin' and admin_unlocked: + if what.split(' ')[1] == 'add': + try: + # get existing list + channelset = set(config.get('channels', 'autojoin').split(',')) + channelset.add(what.split(' ')[2]) + config.set('channels', 'autojoin', ','.join(channelset)) + except NoOptionError: pass + elif what.split(' ')[1] == 'remove': + try: + # get existing list + channelset = set(config.get('channels', 'autojoin').split(',')) + channelset.discard(what.split(' ')[2]) + config.set('channels', 'autojoin', ','.join(channelset)) + except NoOptionError: pass ##### # init