mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 06:00:42 +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
|
If you have the #channel.op capability, this will remove operator
|
||||||
privileges from all the nicks given.
|
privileges from all the nicks given.
|
||||||
"""
|
"""
|
||||||
|
if not args:
|
||||||
|
raise callbacks.ArgumentError
|
||||||
if irc.nick in irc.state.channels[channel].ops:
|
if irc.nick in irc.state.channels[channel].ops:
|
||||||
irc.queueMsg(ircmsgs.deops(channel, args))
|
irc.queueMsg(ircmsgs.deops(channel, args))
|
||||||
else:
|
else:
|
||||||
@ -108,6 +110,8 @@ class Channel(callbacks.Privmsg):
|
|||||||
If you have the #channel.op capability, this will remove half-operator
|
If you have the #channel.op capability, this will remove half-operator
|
||||||
privileges from all the nicks given.
|
privileges from all the nicks given.
|
||||||
"""
|
"""
|
||||||
|
if not args:
|
||||||
|
raise callbacks.ArgumentError
|
||||||
if irc.nick in irc.state.channels[channel].ops:
|
if irc.nick in irc.state.channels[channel].ops:
|
||||||
irc.queueMsg(ircmsgs.dehalfops(channel, args))
|
irc.queueMsg(ircmsgs.dehalfops(channel, args))
|
||||||
else:
|
else:
|
||||||
@ -120,6 +124,8 @@ class Channel(callbacks.Privmsg):
|
|||||||
If you have the #channel.op capability, this will remove voice from all
|
If you have the #channel.op capability, this will remove voice from all
|
||||||
the nicks given.
|
the nicks given.
|
||||||
"""
|
"""
|
||||||
|
if not args:
|
||||||
|
raise callbacks.ArgumentError
|
||||||
if irc.nick in irc.state.channels[channel].ops:
|
if irc.nick in irc.state.channels[channel].ops:
|
||||||
irc.queueMsg(ircmsgs.devoices(channel, args))
|
irc.queueMsg(ircmsgs.devoices(channel, args))
|
||||||
else:
|
else:
|
||||||
@ -141,6 +147,20 @@ class Channel(callbacks.Privmsg):
|
|||||||
irc.queueMsg(ircmsgs.join(channel, key))
|
irc.queueMsg(ircmsgs.join(channel, key))
|
||||||
cycle = privmsgs.checkChannelCapability(cycle, 'op')
|
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):
|
def kban(self, irc, msg, args):
|
||||||
"""[<channel>] <nick> [<number of seconds to ban>]
|
"""[<channel>] <nick> [<number of seconds to ban>]
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
|
|
||||||
def testErrorsWithoutOps(self):
|
def testErrorsWithoutOps(self):
|
||||||
for s in ['op', 'deop', 'voice', 'devoice', 'halfop', 'dehalfop']:
|
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.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))
|
self.irc.feedMsg(ircmsgs.deop(self.channel, self.nick))
|
||||||
|
|
||||||
def testOp(self):
|
def testOp(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user