mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-06 01:24:05 +01:00
Added lobotomies command.
This commit is contained in:
parent
fd06e1c7ee
commit
5dfb00ff7d
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user