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):
|
def sub_join_channel(connection, event, nick, userhost, replypath, what, admin_unlocked):
|
||||||
if what.split(' ')[0] == 'join' and admin_unlocked:
|
if what.split(' ')[0] == 'join' and admin_unlocked:
|
||||||
channel = what.split(' ')[1]
|
channel = what.split(' ')[1]
|
||||||
connection.join(channel)
|
if irclib.is_channel(channel):
|
||||||
connection.privmsg(replypath, 'joined ' + channel + '.')
|
connection.join(channel)
|
||||||
|
connection.privmsg(replypath, 'joined ' + channel + '.')
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# sub_part_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):
|
def sub_part_channel(connection, event, nick, userhost, replypath, what, admin_unlocked):
|
||||||
if what.split(' ')[0] == 'part' and admin_unlocked:
|
if what.split(' ')[0] == 'part' and admin_unlocked:
|
||||||
channel = what.split(' ')[1]
|
channel = what.split(' ')[1]
|
||||||
connection.part(channel, ' '.join(what.split(' ')[2:]))
|
if irclib.is_channel(channel):
|
||||||
connection.privmsg(replypath, 'parted ' + channel + '.')
|
connection.part(channel, ' '.join(what.split(' ')[2:]))
|
||||||
|
connection.privmsg(replypath, 'parted ' + channel + '.')
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# sub_quit_channel
|
# sub_quit_channel
|
||||||
|
@ -55,19 +57,21 @@ def sub_autojoin_manipulate(connection, event, nick, userhost, replypath, what,
|
||||||
try:
|
try:
|
||||||
# get existing list
|
# get existing list
|
||||||
channel = what.split(' ')[2]
|
channel = what.split(' ')[2]
|
||||||
channelset = set(config.get('channels', 'autojoin').split(','))
|
if irclib.is_channel(channel):
|
||||||
channelset.add(channel)
|
channelset = set(config.get('channels', 'autojoin').split(','))
|
||||||
config.set('channels', 'autojoin', ','.join(channelset))
|
channelset.add(channel)
|
||||||
connection.privmsg(replypath, 'added ' + channel + ' to autojoin')
|
config.set('channels', 'autojoin', ','.join(channelset))
|
||||||
|
connection.privmsg(replypath, 'added ' + channel + ' to autojoin')
|
||||||
except NoOptionError: pass
|
except NoOptionError: pass
|
||||||
elif what.split(' ')[1] == 'remove':
|
elif what.split(' ')[1] == 'remove':
|
||||||
try:
|
try:
|
||||||
# get existing list
|
# get existing list
|
||||||
channel = what.split(' ')[2]
|
channel = what.split(' ')[2]
|
||||||
channelset = set(config.get('channels', 'autojoin').split(','))
|
if irclib.is_channel(channel):
|
||||||
channelset.discard(channel)
|
channelset = set(config.get('channels', 'autojoin').split(','))
|
||||||
config.set('channels', 'autojoin', ','.join(channelset))
|
channelset.discard(channel)
|
||||||
connection.privmsg(replypath, 'removed ' + channel + ' from autojoin')
|
config.set('channels', 'autojoin', ','.join(channelset))
|
||||||
|
connection.privmsg(replypath, 'removed ' + channel + ' from autojoin')
|
||||||
except NoOptionError: pass
|
except NoOptionError: pass
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
Loading…
Reference in New Issue