当前位置: 首页>>代码示例>>Python>>正文


Python ircmsgs.part函数代码示例

本文整理汇总了Python中supybot.ircmsgs.part函数的典型用法代码示例。如果您正苦于以下问题:Python part函数的具体用法?Python part怎么用?Python part使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了part函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: part

    def part(self, irc, msg, args, channel, reason):
        """[<channel>] [<reason>]

        Tells the bot to part the list of channels you give it.  <channel> is
        only necessary if you want the bot to part a channel other than the
        current channel.  If <reason> is specified, use it as the part
        message.
        """
        if channel is None:
            if irc.isChannel(msg.args[0]):
                channel = msg.args[0]
            else:
                irc.error(Raise=True)
        try:
            network = conf.supybot.networks.get(irc.network)
            network.channels().remove(channel)
        except KeyError:
            pass
        if channel not in irc.state.channels:
            irc.error(_('I\'m not in %s.') % channel, Raise=True)
        irc.queueMsg(ircmsgs.part(channel, reason or msg.nick))
        if msg.nick in irc.state.channels[channel].users:
            irc.noReply()
        else:
            irc.replySuccess()
开发者ID:frumiousbandersnatch,项目名称:Limnoria,代码行数:25,代码来源:plugin.py

示例2: part

    def part(self, irc, msg, args, channel, reason):
        """[<channel>] [<reason>]

        Tells the bot to part the list of channels you give it.  <channel> is
        only necessary if you want the bot to part a channel other than the
        current channel.  If <reason> is specified, use it as the part
        message.  Otherwise, the default part message specified in
        supybot.plugins.Channel.partMsg will be used. No part message will be
        used if no default is configured.
        """
        if channel is None:
            if irc.isChannel(msg.args[0]):
                channel = msg.args[0]
            else:
                irc.error(Raise=True)
        capability = ircdb.makeChannelCapability(channel, 'op')
        hostmask = irc.state.nickToHostmask(msg.nick)
        if not ircdb.checkCapabilities(hostmask, [capability, 'admin']):
            irc.errorNoCapability(capability, Raise=True)
        try:
            network = conf.supybot.networks.get(irc.network)
            network.channels().remove(channel)
        except KeyError:
            pass
        if channel not in irc.state.channels:
            irc.error(_('I\'m not in %s.') % channel, Raise=True)
        reason = (reason or self.registryValue("partMsg", channel))
        reason = ircutils.standardSubstitute(irc, msg, reason)
        irc.queueMsg(ircmsgs.part(channel, reason))
        if msg.nick in irc.state.channels[channel].users:
            irc.noReply()
        else:
            irc.replySuccess()
开发者ID:Ban3,项目名称:Limnoria,代码行数:33,代码来源:plugin.py

示例3: part

    def part(self, irc, msg, args, channel):
        """<channel>

        Ceases relaying between the channel <channel> on all networks.  The bot
        will part from the channel on all networks in which it is on the
        channel.
        """
        self.registryValue('channels').discard(channel)
        for otherIrc in world.ircs:
            if channel in otherIrc.state.channels:
                otherIrc.queueMsg(ircmsgs.part(channel))
        irc.replySuccess()
开发者ID:GlitterCakes,项目名称:PoohBot,代码行数:12,代码来源:plugin.py

示例4: testOpTrack

 def testOpTrack(self):
     cb = self.getCallback()
     self.assertEqual(cb.opped['#test'], False)
     self.op()
     self.assertEqual(cb.opped['#test'], True)
     self.deop()
     self.assertEqual(cb.opped['#test'], False)
     self.op()
     self.irc.feedMsg(ircmsgs.part('#test', prefix=self.prefix))
     self.irc.feedMsg(ircmsgs.join('#test', prefix=self.prefix))
     self.irc.takeMsg() # MODE msg
     self.irc.takeMsg() # WHO msg
     self.assertEqual(cb.opped['#test'], False)
开发者ID:bnrubin,项目名称:Bantracker,代码行数:13,代码来源:test.py

示例5: cycle

    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 <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.
        """
        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))
开发者ID:Ban3,项目名称:Limnoria,代码行数:15,代码来源:plugin.py

示例6: feedBan

 def feedBan(self, hostmask, prefix='', channel=None, mode='b'):
     if not channel:
         channel = self.channel
     if not prefix:
         prefix = '[email protected]'
     if mode == 'b':
         ban = ircmsgs.ban(channel, hostmask, prefix=prefix)
     elif mode == 'q':
         ban = quiet(channel, hostmask, prefix=prefix)
     elif mode == 'k':
         ban = ircmsgs.kick(channel, hostmask, s='kthxbye!', prefix=prefix)
     elif mode == 'p':
         ban = ircmsgs.part(channel, prefix=hostmask,
                 s='requested by %s (kthxbye!)' %prefix[:prefix.find('!')])
     self.irc.feedMsg(ban)
     return ban
开发者ID:bnrubin,项目名称:Bantracker,代码行数:16,代码来源:test.py

示例7: testPart

 def testPart(self):
     self.prefix = '[email protected]'
     self.assertRegexp('gpg ident', 'are identified')
     self.irc.feedMsg(msg=ircmsgs.part("#test", prefix=self.prefix))
     self.assertRegexp('gpg ident', 'not identified')
开发者ID:therealplato,项目名称:supybot-bitcoin-marketmonitor,代码行数:5,代码来源:test.py

示例8: partChannel

 def partChannel(self, irc, channel):
     if not self.botInChannel(irc, channel):
         logger.info('already parted '+channel)
     else:
         logger.info('part channel '+channel)
         irc.queueMsg(ircmsgs.part(channel,'Game stopped'))
开发者ID:ircpuzzles,项目名称:competitionbot,代码行数:6,代码来源:plugin.py

示例9: _track_time_and_part

 def _track_time_and_part(self, irc, channel, nick):
     reason = "Your time's up, for new request please contact my owner."
     irc.queueMsg(ircmsgs.kick(channel, nick, reason))
     irc.queueMsg(ircmsgs.part(channel))
开发者ID:kg-bot,项目名称:SupyBot,代码行数:4,代码来源:plugin.py


注:本文中的supybot.ircmsgs.part函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。