mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Made sure the pluralized power commands don't get run with no arguments.
This commit is contained in:
parent
e4d9f6ded2
commit
4726fdf223
@ -96,6 +96,8 @@ class Channel(callbacks.Privmsg):
|
||||
If you have the #channel.op capability, this will remove operator
|
||||
privileges from all the nicks given.
|
||||
"""
|
||||
if not args:
|
||||
raise callbacks.ArgumentError
|
||||
if irc.nick in irc.state.channels[channel].ops:
|
||||
irc.queueMsg(ircmsgs.deops(channel, args))
|
||||
else:
|
||||
@ -108,6 +110,8 @@ class Channel(callbacks.Privmsg):
|
||||
If you have the #channel.op capability, this will remove half-operator
|
||||
privileges from all the nicks given.
|
||||
"""
|
||||
if not args:
|
||||
raise callbacks.ArgumentError
|
||||
if irc.nick in irc.state.channels[channel].ops:
|
||||
irc.queueMsg(ircmsgs.dehalfops(channel, args))
|
||||
else:
|
||||
@ -120,6 +124,8 @@ class Channel(callbacks.Privmsg):
|
||||
If you have the #channel.op capability, this will remove voice from all
|
||||
the nicks given.
|
||||
"""
|
||||
if not args:
|
||||
raise callbacks.ArgumentError
|
||||
if irc.nick in irc.state.channels[channel].ops:
|
||||
irc.queueMsg(ircmsgs.devoices(channel, args))
|
||||
else:
|
||||
@ -141,6 +147,20 @@ class Channel(callbacks.Privmsg):
|
||||
irc.queueMsg(ircmsgs.join(channel, key))
|
||||
cycle = privmsgs.checkChannelCapability(cycle, 'op')
|
||||
|
||||
def kick(self, irc, msg, args, channel):
|
||||
"""[<channel>] <nick> [<reason>]
|
||||
|
||||
Kicks <nick> from <channel> for <reason>. If <reason> isn't given,
|
||||
uses the nick of the person making the command as the reason.
|
||||
<channel> is only necessary if the message isn't sent in the channel
|
||||
itself.
|
||||
"""
|
||||
(nick, reason) = privmsgs.getArgs(args, optional=1)
|
||||
if not reason:
|
||||
reason = msg.nick
|
||||
irc.queueMsg(ircmsgs.kick(channel, nick, reason))
|
||||
kick = privmsgs.checkChannelCapability(kick, 'op')
|
||||
|
||||
def kban(self, irc, msg, args):
|
||||
"""[<channel>] <nick> [<number of seconds to ban>]
|
||||
|
||||
|
@ -50,9 +50,9 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
|
||||
def testErrorsWithoutOps(self):
|
||||
for s in ['op', 'deop', 'voice', 'devoice', 'halfop', 'dehalfop']:
|
||||
self.assertError(s)
|
||||
self.assertError('%s foo' % s)
|
||||
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
|
||||
self.assertNotError(s)
|
||||
self.assertNotError('%s foo' % s)
|
||||
self.irc.feedMsg(ircmsgs.deop(self.channel, self.nick))
|
||||
|
||||
def testOp(self):
|
||||
|
Loading…
Reference in New Issue
Block a user