diff --git a/dr.botzo.py b/dr.botzo.py index 4ff7697..f8304ff 100755 --- a/dr.botzo.py +++ b/dr.botzo.py @@ -15,8 +15,9 @@ import irclib def sub_join_channel(connection, event, nick, userhost, replypath, what, admin_unlocked): if what.split(' ')[0] == 'join' and admin_unlocked: channel = what.split(' ')[1] - connection.join(channel) - connection.privmsg(replypath, 'joined ' + channel + '.') + if irclib.is_channel(channel): + connection.join(channel) + connection.privmsg(replypath, 'joined ' + channel + '.') ##### # sub_part_channel @@ -27,8 +28,9 @@ def sub_join_channel(connection, event, nick, userhost, replypath, what, admin_u def sub_part_channel(connection, event, nick, userhost, replypath, what, admin_unlocked): if what.split(' ')[0] == 'part' and admin_unlocked: channel = what.split(' ')[1] - connection.part(channel, ' '.join(what.split(' ')[2:])) - connection.privmsg(replypath, 'parted ' + channel + '.') + if irclib.is_channel(channel): + connection.part(channel, ' '.join(what.split(' ')[2:])) + connection.privmsg(replypath, 'parted ' + channel + '.') ##### # sub_quit_channel @@ -55,19 +57,21 @@ def sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what, try: # get existing list channel = what.split(' ')[2] - channelset = set(config.get('channels', 'autojoin').split(',')) - channelset.add(channel) - config.set('channels', 'autojoin', ','.join(channelset)) - connection.privmsg(replypath, 'added ' + channel + ' to autojoin') + if irclib.is_channel(channel): + channelset = set(config.get('channels', 'autojoin').split(',')) + channelset.add(channel) + config.set('channels', 'autojoin', ','.join(channelset)) + connection.privmsg(replypath, 'added ' + channel + ' to autojoin') except NoOptionError: pass elif what.split(' ')[1] == 'remove': try: # get existing list channel = what.split(' ')[2] - channelset = set(config.get('channels', 'autojoin').split(',')) - channelset.discard(channel) - config.set('channels', 'autojoin', ','.join(channelset)) - connection.privmsg(replypath, 'removed ' + channel + ' from autojoin') + if irclib.is_channel(channel): + channelset = set(config.get('channels', 'autojoin').split(',')) + channelset.discard(channel) + config.set('channels', 'autojoin', ','.join(channelset)) + connection.privmsg(replypath, 'removed ' + channel + ' from autojoin') except NoOptionError: pass #####