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


Python ircutils.toLower函数代码示例

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


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

示例1: doPrivmsg

 def doPrivmsg(self, irc, msg):
     self.addIRC(irc)
     channel = msg.args[0]
     s = msg.args[1]
     s, args = self.getPrivmsgData(channel, msg.nick, s,
                            self.registryValue('color', channel))
     ignoreNicks = [ircutils.toLower(item) for item in \
         self.registryValue('nickstoIgnore.nicks', msg.args[0])]
     if self.registryValue('nickstoIgnore.affectPrivmsgs', msg.args[0]) \
         == 1 and ircutils.toLower(msg.nick) in ignoreNicks:
             #self.log.debug('LinkRelay: %s in nickstoIgnore...' % ircutils.toLower(msg.nick))
             #self.log.debug('LinkRelay: List of ignored nicks: %s' % ignoreNicks)
             return
     elif channel not in irc.state.channels: # in private
         # cuts off the end of commands, so that passwords
         # won't be revealed in relayed PM's
         if callbacks.addressed(irc.nick, msg):
             if self.registryValue('color', channel):
                 color = '\x03' + self.registryValue('colors.truncated',
                         channel)
                 match = '(>\017 \w+) .*'
             else:
                 color = ''
                 match = '(> \w+) .*'
             s = re.sub(match, '\\1 %s[%s]' % (color, _('truncated')), s)
         s = '(via PM) %s' % s
     self.sendToOthers(irc, channel, s, args, isPrivmsg=True)
开发者ID:liam-middlebrook,项目名称:SupyPlugins,代码行数:27,代码来源:plugin.py

示例2: rpm

    def rpm(self, irc, msg, args, remoteuser, otherIrc, text):
        """<remoteUser> <network> <text>

        Sends a private message to a user on a remote network."""
        found = found2 = False
        if not self.registryValue("remotepm.enable"):
            irc.error("This command is not enabled; please set 'config plugins.relaylink.remotepm.enable' "
                "to True.", Raise=True)
        for relay in self.relays:
            channels = otherIrc.state.channels
            for key, channel_ in channels.items():
                if ircutils.toLower(relay.targetChannel) \
                    == ircutils.toLower(key) and remoteuser in channel_.users:
                    found = True
                    break
            for ch in irc.state.channels:
                if ircutils.toLower(relay.sourceChannel) == \
                    ircutils.toLower(ch) and msg.nick in irc.state.channels[ch].users:
                    found2 = True
                    break
        if found and found2:
            prefix = msg.prefix if self.registryValue("remotepm.useHostmasks") else msg.nick
            if self.registryValue("remotepm.useNotice"):
                otherIrc.queueMsg(ircmsgs.notice(remoteuser, "Message from %s on %s: %s" % (prefix, irc.network, text)))
            else:
                otherIrc.queueMsg(ircmsgs.privmsg(remoteuser, "Message from %s on %s: %s" % (prefix, irc.network, text)))
        else:
            irc.error("User '%s' does not exist on %s or you are not sharing "
                "a channel with them." % (remoteuser, otherIrc.network), Raise=True)
开发者ID:lilsnooker,项目名称:SupyPlugins,代码行数:29,代码来源:plugin.py

示例3: key

 def key(self, k):
     if isinstance(k, str):
         k = ircutils.toLower(k)
     elif isinstance(k, tuple):
         k = tuple([(ircutils.toLower(x) if isinstance(x, str) else x) for x in k])
     else:
         assert False
     return k
开发者ID:GLolol,项目名称:ProgVal-Supybot-plugins,代码行数:8,代码来源:plugin.py

示例4: doMode

 def doMode(self, irc, msg):
     ignoreNicks = [ircutils.toLower(item) for item in \
         self.registryValue('nickstoIgnore.nicks', msg.args[0])]
     if ircutils.toLower(msg.nick) not in ignoreNicks:
         self.addIRC(irc)
         args = {'nick': msg.nick, 'channel': msg.args[0],
                 'mode': ' '.join(msg.args[1:]), 'color': ''}
         if self.registryValue('color', msg.args[0]):
             args['color'] = '\x03%s' % self.registryValue('colors.mode', msg.args[0])
         s = '%(color)s' + _('MODE: %(nick)s%(sepTagn)s%(network)s sets mode %(mode)s '
                 ' on %(channel)s%(sepTagc)s%(network)s')
         self.sendToOthers(irc, msg.args[0], s, args)
开发者ID:liam-middlebrook,项目名称:SupyPlugins,代码行数:12,代码来源:plugin.py

示例5: doQuit

 def doQuit(self, irc, msg):
     ignoreNicks = [ircutils.toLower(item) for item in \
         self.registryValue('nickstoIgnore.nicks', msg.args[0])]
     if ircutils.toLower(msg.nick) not in ignoreNicks:
         args = {'nick': msg.nick, 'network': irc.network,
                 'message': msg.args[0], 'color': '', 'userhost': ''}
         if self.registryValue('color', msg.args[0]):
             args['color'] = '\x03%s' % self.registryValue('colors.quit', msg.args[0])
         s = '%(color)s' + _('QUIT: %(nick)s%(sepTagn)s%(network)s'
                 ' has quit (%(message)s)')
         self.sendToOthers(irc, None, s, args, msg.nick)
         self.addIRC(irc)
开发者ID:liam-middlebrook,项目名称:SupyPlugins,代码行数:12,代码来源:plugin.py

示例6: doKick

 def doKick(self, irc, msg):
     """Kill the authentication when user gets kicked."""
     channels = self.registryValue("channels").split(";")
     if msg.args[0] in channels and irc.network == self.registryValue("network"):
         (channel, nick) = msg.args[:2]
         if ircutils.toLower(irc.nick) in ircutils.toLower(nick):
             self.authlog.info("***** clearing authed_users due to self-kick. *****")
             self.authed_users.clear()
         else:
             try:
                 hostmask = irc.state.nickToHostmask(nick)
                 self._unauth(irc, hostmask)
             except KeyError:
                 pass
开发者ID:waldher,项目名称:supybot-bitcoin-marketmonitor,代码行数:14,代码来源:plugin.py

示例7: doNick

 def doNick(self, irc, msg):
     ignoreNicks = [ircutils.toLower(item) for item in \
         self.registryValue('nickstoIgnore.nicks', msg.args[0])]
     if ircutils.toLower(msg.nick) not in ignoreNicks:
         self.addIRC(irc)
         args = {'oldnick': msg.nick, 'network': irc.network,
                 'newnick': msg.args[0], 'color': ''}
         if self.registryValue('color', msg.args[0]):
             args['color'] = '\x03%s' % self.registryValue('colors.nick', msg.args[0])
         s = '%(color)s' + _('NICK: %(oldnick)s%(sepTagn)s%(network)s'
                 ' changed nick to %(newnick)s')
         for (channel, c) in irc.state.channels.iteritems():
             if msg.args[0] in c.users:
                 self.sendToOthers(irc, channel, s, args)
开发者ID:liam-middlebrook,项目名称:SupyPlugins,代码行数:14,代码来源:plugin.py

示例8: doKick

 def doKick(self, irc, msg):
     """Kill the authentication when user gets kicked."""
     channels = self.registryValue('channels').split(';')
     if msg.args[0] in channels and irc.network == self.registryValue('network'):
         (channel, nicks) = msg.args[:2]
         if ircutils.toLower(irc.nick) in ircutils.toLower(nicks).split(','):
             self.authed_users.clear()
         else:
             for nick in nicks:
                 try:
                     hostmask = irc.state.nickToHostmask(nick)
                     self._unauth(hostmask)
                 except KeyError:
                     pass
开发者ID:Krisseck,项目名称:supybot-bitcoin-marketmonitor,代码行数:14,代码来源:plugin.py

示例9: doJoin

 def doJoin(self, irc, msg):
     ignoreNicks = [ircutils.toLower(item) for item in \
         self.registryValue('nickstoIgnore.nicks', msg.args[0])]
     if ircutils.toLower(msg.nick) not in ignoreNicks:
         self.addIRC(irc)
         args = {'nick': msg.nick, 'channel': msg.args[0], 'color': '',
                 'userhost': ''}
         if self.registryValue('color', msg.args[0]):
             args['color'] = '\x03%s' % self.registryValue('colors.join', msg.args[0])
         if self.registryValue('hostmasks', msg.args[0]):
             args['userhost'] = ' (%[email protected]%s)' % (msg.user, msg.host)
         s = '%(color)s' + _('JOIN: %(nick)s%(sepTagn)s%(network)s'
                 '%(userhost)s has joined %(channel)s%(sepTagc)s'
                 '%(network)s')
         self.sendToOthers(irc, msg.args[0], s, args)
开发者ID:liam-middlebrook,项目名称:SupyPlugins,代码行数:15,代码来源:plugin.py

示例10: start

    def start(self, irc, msg, args, channel, num):
        """[<kanal>] [<broj pitanja>]

        Zapocinje novu igru.  <kanal> nije obavezan osim u slucaju da komandu dajete botu na PM."""
        if num == None:
            num = self.registryValue('defaultRoundLength', channel)
        #elif num > 100:
        #    irc.reply('Zao nam je ali za sada ne mozete igrati sa vise '
        #              'od 100 pitanja :(')
        #    num = 100
        channel = ircutils.toLower(channel)
        if channel in self.games:
            if not self.games[channel].active:
                del self.games[channel]
                try:
                    schedule.removeEvent('next_%s' % channel)
                except KeyError:
                    pass
                irc.reply(_('Orphaned trivia game found and removed.'))
            else:
                self.games[channel].num += num
                self.games[channel].total += num
                irc.reply(_('%d pitanja dodano u trenutnu igru!') % num)
        else:
            self.games[channel] = self.Game(irc, channel, num, self)
        irc.noReply()
开发者ID:kg-bot,项目名称:SupyBot,代码行数:26,代码来源:plugin.py

示例11: addwebhook

 def addwebhook(self, irc, msg, args, optrepo, optchannel):
     """<repository name> [#channel]
     
     Add announcing of repository webhooks to channel.
     """
     
     # first check for channel.
     chan = msg.args[0]
     if not irc.isChannel(ircutils.toLower(chan)):  # we're NOT run in a channel.
         if not optchannel:
             irc.reply("ERROR: You must specify a channel or run from a channel in order to add.")
             return
         else:  # set chan as what the user wants.
             chan = optchannel
     # lower both
     chan = chan.lower()
     optrepo = optrepo.lower()
     # now lets try and add the repo. sanity check if present first.
     if optrepo in self._webhooks:  # channel already in the webhooks.
         if chan in self._webhooks[optrepo]:  # channel already there.
             irc.reply("ERROR: {0} is already being announced on {1}".format(optrepo, chan))
             return
     # last check is to see if we're on the channel.
     if chan not in irc.state.channels:
         irc.reply("ERROR: I must be present on a channel ({0}) you're trying to add.".format(chan))
         return
     # otherwise, we're good. lets use the _addHook.
     try:
         self._webhooks[optrepo].add(chan)
         self._savepickle() # save.
         irc.replySuccess()
     except Exception as e:
         irc.reply("ERROR: I could not add {0} to {1} :: {2}".format(optrepo, chan, e))
开发者ID:reticulatingspline,项目名称:WebHooks,代码行数:33,代码来源:plugin.py

示例12: start

    def start(self, irc, msg, args, channel, num):
        """[<channel>] [<number of questions>]

        Starts a game of trivia.  <channel> is only necessary if the message
        isn't sent in the channel itself."""
        if num == None:
            num = self.registryValue('defaultRoundLength', channel)
        #elif num > 100:
        #    irc.reply('sorry, for now, you can\'t start games with more '
        #              'than 100 questions :(')
        #    num = 100
        channel = ircutils.toLower(channel)
        if channel in self.games:
            if not self.games[channel].active:
                del self.games[channel]
                try:
                    schedule.removeEvent('next_%s' % channel)
                except KeyError:
                    pass
                irc.reply(_('Orphaned trivia game found and removed.'))
            else:
                self.games[channel].num += num
                self.games[channel].total += num
                irc.reply(_('%d questions added to active game!') % num)
        else:
            self.games[channel] = self.Game(irc, channel, num, self)
        irc.noReply()
开发者ID:AlanBell,项目名称:Supybot-plugins,代码行数:27,代码来源:plugin.py

示例13: add

 def add(self, capability):
     """Adds a capability to the set."""
     capability = ircutils.toLower(capability)
     inverted = _invert(capability)
     if self.__parent.__contains__(inverted):
         self.__parent.remove(inverted)
     self.__parent.add(capability)
开发者ID:Elwell,项目名称:supybot,代码行数:7,代码来源:ircdb.py

示例14: delwebhook

 def delwebhook(self, irc, msg, args, optrepo, optchannel):
     """<repo> <channel>
     
     Delete announcement of repository from channel.
     """
     
     # first check for channel.
     chan = msg.args[0]
     if not irc.isChannel(ircutils.toLower(chan)):  # we're NOT run in a channel.
         if not optchannel:
             irc.reply("ERROR: You must specify a channel or run from a channel in order to add.")
             return
         else:  # set chan as what the user wants.
             chan = optchannel
     # lower both
     chan = chan.lower()
     optrepo = optrepo.lower()
     # make sure repo is valid.
     if optrepo not in self._webhooks:  # channel already in the webhooks.
         irc.reply("ERROR: {0} repository is invalid. Valid choices: {0}".format(self._webhooks.keys()))
         return
     # if repo is valid, make sure channel is in there.
     if chan not in self._webhooks[optrepo]:  # channel already there.
         irc.reply("ERROR: {0} is an invalid channel for repository: {1}. Repos being announced: {2}".format(chan, optrepo, self._webhooks[optrepo]))
         return
     # we're here if all is good. lets try to delete.
     try:
         self._webhooks[optrepo].remove(chan)  # delete.
         # now lets check if the channel is empty and remove if it is.
         if len(self._webhooks[optrepo]) == 0:
             del self._webhooks[optrepo]
         irc.replySuccess()
     except Exception as e:
         irc.reply("ERROR: I could not delete channel {0} for {1} :: {2}".format(chan, optrepo, e))
开发者ID:reticulatingspline,项目名称:WebHooks,代码行数:34,代码来源:plugin.py

示例15: cutwire

    def cutwire(self, irc, msg, args, channel, cutWire):
        """<colored wire>

        Will cut the given wire if you've been timebombed."""
        channel = ircutils.toLower(channel)
        try:
            if not self.bombs[channel].active:
                return
            if not ircutils.nickEqual(self.bombs[channel].victim, msg.nick):
                irc.reply('You can\'t cut the wire on someone else\'s bomb!')
                return
            else:
                self.responded = True

            spellCheck = False
            for item in self.bombs[channel].wires :
                if item.lower() == cutWire.lower():
                    spellCheck = True
            if spellCheck == False :
                irc.reply("That doesn't appear to be one of the options.")
                return
                
            self.bombs[channel].cutwire(irc, cutWire)
        except KeyError:
            pass
        irc.noReply()
开发者ID:alxsoares,项目名称:supybot-plugins,代码行数:26,代码来源:plugin.py


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