Channel.cycle: allow specifying part message + defaults to plugins.Channel.partMsg

Closes #1062.
This commit is contained in:
James Lu 2015-02-27 18:27:58 -08:00
parent a67fb94875
commit 32988ee3a3

View File

@ -258,17 +258,22 @@ class Channel(callbacks.Plugin):
any('nickInChannel')])
@internationalizeDocstring
def cycle(self, irc, msg, args, channel):
def cycle(self, irc, msg, args, channel, reason):
"""[<channel>]
If you have the #channel,op capability, this will cause the bot to
"cycle", or PART and then JOIN the channel. <channel> is only necessary
if the message isn't sent in the channel itself.
if the message isn't sent in the channel itself. If <reason> is not
specified, the default part message specified in
supybot.plugins.Channel.partMsg will be used. No part message will be
used if neither a cycle reason nor a default part message is given.
"""
self._sendMsg(irc, ircmsgs.part(channel, msg.nick))
reason = (reason or self.registryValue("partMsg", channel))
reason = ircutils.standardSubstitute(irc, msg, reason)
self._sendMsg(irc, ircmsgs.part(channel, reason))
networkGroup = conf.supybot.networks.get(irc.network)
self._sendMsg(irc, networkGroup.channels.join(channel))
cycle = wrap(cycle, ['op'])
cycle = wrap(cycle, ['op', additional('text')])
@internationalizeDocstring
def kick(self, irc, msg, args, channel, nicks, reason):