mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-29 10:56:57 +01:00
Added Channel.limit.
This commit is contained in:
parent
35038fd376
commit
f871d3828c
@ -1,4 +1,5 @@
|
|||||||
* Added Channel.mode, to set the mode in the channel.
|
* Added Channel.mode, to set modes in the channel, and
|
||||||
|
Channel.limit, to set the channel limit.
|
||||||
|
|
||||||
* Added a new plugin, Format, which offers several commands for
|
* Added a new plugin, Format, which offers several commands for
|
||||||
formatting strings on IRC. Moved several commands from to it
|
formatting strings on IRC. Moved several commands from to it
|
||||||
|
@ -69,12 +69,35 @@ class Channel(callbacks.Privmsg):
|
|||||||
"""[<channel>] <mode> [<arg> ...]
|
"""[<channel>] <mode> [<arg> ...]
|
||||||
|
|
||||||
Sets the mode in <channel> to <mode>, sending the arguments given.
|
Sets the mode in <channel> to <mode>, sending the arguments given.
|
||||||
|
<channel> is only necessary if the message isn't sent in the channel
|
||||||
|
itself.
|
||||||
"""
|
"""
|
||||||
if not args:
|
if not args:
|
||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
irc.queueMsg(ircmsgs.mode(channel, args))
|
irc.queueMsg(ircmsgs.mode(channel, args))
|
||||||
mode = privmsgs.checkChannelCapability(mode, 'op')
|
mode = privmsgs.checkChannelCapability(mode, 'op')
|
||||||
|
|
||||||
|
def limit(self, irc, msg, args, channel):
|
||||||
|
"""[<channel>] <limit>
|
||||||
|
|
||||||
|
Sets the channel limit to <limit>. If <limit> is 0, removes the
|
||||||
|
channel limit. <channel> is only necessary if the message isn't sent
|
||||||
|
in the channel itself.
|
||||||
|
"""
|
||||||
|
limit = privmsg.getArgs(args)
|
||||||
|
try:
|
||||||
|
limit = int(limit)
|
||||||
|
if limit < 0:
|
||||||
|
raise ValueError
|
||||||
|
except ValueError:
|
||||||
|
irc.error('%r is not a positive integer.' % limit)
|
||||||
|
return
|
||||||
|
if limit:
|
||||||
|
irc.queueMsg(ircmsgs.mode(channel, ['+l', limit]))
|
||||||
|
else:
|
||||||
|
irc.queueMsg(ircmsgs.mode(channel, ['-l']))
|
||||||
|
limit = privmsgs.checkChannelCapability(limit, 'op')
|
||||||
|
|
||||||
def op(self, irc, msg, args, channel):
|
def op(self, irc, msg, args, channel):
|
||||||
"""[<channel>] [<nick> ...]
|
"""[<channel>] [<nick> ...]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user