Let's catch this KeyError, shall we?

This commit is contained in:
Jeremy Fincher 2004-07-31 07:45:19 +00:00
parent fbe80ef138
commit 5d542dcdd1
1 changed files with 9 additions and 5 deletions

View File

@ -60,11 +60,15 @@ conf.registerChannelValue(conf.supybot.plugins.Channel, 'alwaysRejoin',
class Channel(callbacks.Privmsg):
def haveOps(self, irc, channel, what):
if irc.nick in irc.state.channels[channel].ops:
return True
else:
irc.error('How can I %s? I\'m not opped in %s.' % (what, channel))
return False
try:
if irc.nick in irc.state.channels[channel].ops:
return True
else:
irc.error('How can I %s? I\'m not opped in %s.' %
(what, channel))
return False
except KeyError:
irc.error('I don\'t seem to be in %s.' % channel)
def doKick(self, irc, msg):
channel = msg.args[0]