Added lobotomies command.

This commit is contained in:
Jeremy Fincher 2003-12-03 01:28:31 +00:00
parent fd06e1c7ee
commit 5dfb00ff7d
3 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,6 @@
* Added a Channel.lobotomies command to list the channels in which
the bot is lobotomized.
* Added a swap function to Math.rpn.
* Changed the logging infrastructure significantly; each plugin

View File

@ -377,6 +377,21 @@ class Channel(callbacks.Privmsg):
c = ircdb.channels.getChannel(channel)
irc.reply(msg, ', '.join(c.capabilities))
def lobotomies(self, irc, msg, args):
"""takes no arguments
Returns the channels in which this bot is lobotomized.
"""
L = []
for (channel, c) in ircdb.channels.iteritems():
if c.lobotomized:
L.append(channel)
if L:
s = 'I\'m currently lobotomized in %s.' % utils.commaAndify(L)
irc.reply(msg, s)
else:
irc.reply(msg, 'I\'m not currently lobotomized in any channels.')
Class = Channel

View File

@ -37,6 +37,9 @@ import ircmsgs
class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('Channel',)
def testLobotomies(self):
self.assertRegexp('lobotomies', 'not.*any')
def testUnban(self):
self.assertError('unban foo!bar@baz')
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))