IrcAdmin: don't crash by trying to tell #chan that you just left #chan

This commit is contained in:
Brian S. Stephan 2011-06-20 20:27:20 -05:00
parent 75ba29739c
commit c7846e415a
2 changed files with 4 additions and 4 deletions

2
BUGS
View File

@ -1,7 +1,5 @@
dr.botzo --- BUGS
* being in #chan and telling the bot to !part #chan is a crash if it can't message
#chan after it leaves
* Countdown formatting has singular nouns for negative numbers (-21 day)
* probably many, many more
* possible to have not well-formed XML in pywapi.get_weather_from_google:

View File

@ -95,12 +95,14 @@ class IrcAdmin(Module):
def sub_part_channel(self, connection, event, nick, userhost, what, admin_unlocked):
whats = what.split(' ')
target = event.target()
channel = whats[1]
if irclib.is_channel(channel):
connection.part(channel, ' '.join(whats[2:]))
replystr = 'Parted ' + channel + '.'
return replystr
if target != channel:
replystr = 'Parted ' + channel + '.'
return replystr
def sub_quit_irc(self, connection, event, nick, userhost, what, admin_unlocked):
whats = what.split(' ')