The bot won't de itself anymore.

This commit is contained in:
Jeremy Fincher 2004-02-07 06:24:45 +00:00
parent aa6e663768
commit 1c1046cddb
2 changed files with 20 additions and 7 deletions

View File

@ -100,7 +100,11 @@ class Channel(callbacks.Privmsg):
"""
if not args:
args.append(msg.nick)
if irc.nick in irc.state.channels[channel].ops:
if irc.nick in args:
irc.error('I cowardly refuse to deop myself. If you really want '
'me deopped, tell me to op you and then deop me '
'yourself.')
elif irc.nick in irc.state.channels[channel].ops:
irc.queueMsg(ircmsgs.deops(channel, args))
else:
irc.error('How can I deop someone? I\'m not opped!')
@ -115,7 +119,11 @@ class Channel(callbacks.Privmsg):
"""
if not args:
args.append(msg.nick)
if irc.nick in irc.state.channels[channel].ops:
if irc.nick in args:
irc.error('I cowardly refuse to dehalfop myself. If you really '
'want me dehalfopped, tell me to op you and then '
'dehalfop me yourself.')
elif irc.nick in irc.state.channels[channel].ops:
irc.queueMsg(ircmsgs.dehalfops(channel, args))
else:
irc.error('How can I dehalfop someone? I\'m not opped!')
@ -130,7 +138,11 @@ class Channel(callbacks.Privmsg):
"""
if not args:
args.append(msg.nick)
if irc.nick in irc.state.channels[channel].ops:
if irc.nick in args:
irc.error('I cowardly refuse to devoice myself. If you really '
'want me devoiced, tell me to op you and then devoice '
'me yourself.')
elif irc.nick in irc.state.channels[channel].ops:
irc.queueMsg(ircmsgs.devoices(channel, args))
else:
irc.error('How can I devoice someone? I\'m not opped!')

View File

@ -72,6 +72,11 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertNotError('%s foo' % s)
self.irc.feedMsg(ircmsgs.deop(self.channel, self.nick))
def testWontDeItself(self):
for s in 'deop dehalfop devoice'.split():
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
self.assertError('%s %s' % (s, self.nick))
def testOp(self):
self.assertError('op')
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
@ -114,10 +119,6 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertNotRegexp('kban foobar time', 'ValueError')
self.assertError('kban %s' % self.irc.nick)
def testLobotomizers(self):
self.assertNotError('lobotomize')
self.assertNotError('unlobotomize')
def testPermban(self):
self.assertNotError('permban foo!bar@baz')
self.assertNotError('unpermban foo!bar@baz')