Added Channel.limit.

This commit is contained in:
Jeremy Fincher 2004-07-23 01:19:30 +00:00
parent 35038fd376
commit f871d3828c
2 changed files with 25 additions and 1 deletions

View File

@ -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
formatting strings on IRC. Moved several commands from to it

View File

@ -69,12 +69,35 @@ class Channel(callbacks.Privmsg):
"""[<channel>] <mode> [<arg> ...]
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:
raise callbacks.ArgumentError
irc.queueMsg(ircmsgs.mode(channel, args))
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):
"""[<channel>] [<nick> ...]