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