check for channel with is_channel in a couple places where it's relevant
This commit is contained in:
parent
f170743837
commit
934e8e3fe8
28
dr.botzo.py
28
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
|
||||
|
||||
#####
|
||||
|
|
Loading…
Reference in New Issue