mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Added an unban command.
This commit is contained in:
parent
db720ce810
commit
6476e63f20
@ -37,6 +37,7 @@ to have the <channel>.op capability. This plugin is loaded by default.
|
||||
import time
|
||||
|
||||
import conf
|
||||
import debug
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import schedule
|
||||
@ -128,6 +129,22 @@ class ChannelCommands(callbacks.Privmsg):
|
||||
else:
|
||||
irc.error(msg, conf.replyNoCapability % capability)
|
||||
|
||||
def unban(self, irc, msg, args, channel):
|
||||
"""[<channel>] <hostmask>
|
||||
|
||||
Unbans <hostmask> on <channel>. Especially useful for unbanning
|
||||
yourself when you get unexpectedly (or accidentally) banned from
|
||||
the channel. <channel> is only necessary if the message isn't sent
|
||||
in the channel itself.
|
||||
"""
|
||||
hostmask = privmsgs.getArgs(args)
|
||||
if irc.nick in irc.state.channels[channel].ops:
|
||||
irc.queueMsg(ircmsgs.unban(channel, hostmask))
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
else:
|
||||
irc.error(msg, 'How can I unban someone? I\'m not opped.')
|
||||
unban = privmsgs.checkChannelCapability(unban, 'op')
|
||||
|
||||
def lobotomize(self, irc, msg, args, channel):
|
||||
"""[<channel>]
|
||||
|
||||
|
@ -37,6 +37,16 @@ import ircmsgs
|
||||
|
||||
class ChannelCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
plugins = ('ChannelCommands',)
|
||||
def testUnban(self):
|
||||
self.assertError('unban foo!bar@baz')
|
||||
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
|
||||
m = self.getMsg('unban foo!bar@baz')
|
||||
print
|
||||
debug.printf(m)
|
||||
self.assertEqual(m.command, 'MODE')
|
||||
self.assertEqual(m.args, (self.channel, '-b', 'foo!bar@baz'))
|
||||
self.assertNotError(' ')
|
||||
|
||||
def testOp(self):
|
||||
self.assertError('op')
|
||||
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
|
||||
|
Loading…
Reference in New Issue
Block a user