• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ircutils.toLower函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: do311

 def do311(self, irc, msg):
     irc = self._getRealIrc(irc)
     nick = ircutils.toLower(msg.args[1])
     if (irc, nick) not in self._whois:
         return
     else:
         self._whois[(irc, nick)][-1][msg.command] = msg
开发者ID:GlitterCakes,项目名称:PoohBot,代码行数:7,代码来源:plugin.py


示例17: randombomb

    def randombomb(self, irc, msg, args, channel, nicks):
        """takes no arguments

        Bombs a random person in the channel
        """
        channel = ircutils.toLower(channel)
        if not self.registryValue('allowBombs', msg.args[0]):
            irc.reply('Timebombs aren\'t allowed in this channel.  Set plugins.Timebomb.allowBombs to true if you want them.')
            return
        try:
            if self.bombs[channel].active:
                irc.reply('There\'s already an active bomb, in %s\'s pants!' % self.bombs[channel].victim)
                return
        except KeyError:
            pass
        if self.registryValue('bombActiveUsers', msg.args[0]):
            if len(nicks) == 0:
                nicks = list(irc.state.channels[channel].users)
                items = self.talktimes.iteritems()
                nicks = []
                for i in range(0, len(self.talktimes)):
                    try:
                        item = items.next()
                        if time.time() - item[1] < self.registryValue('idleTime', msg.args[0])*60 and item[0] in irc.state.channels[channel].users:
                            nicks.append(item[0])
                    except StopIteration:
                        irc.reply('hey quantumlemur, something funny happened... I got a StopIteration exception')
                if len(nicks) == 1 and nicks[0] == msg.nick:
                    nicks = []
            if len(nicks) == 0:
                irc.reply('Well, no one\'s talked in the past hour, so I guess I\'ll just choose someone from the whole channel')
                nicks = list(irc.state.channels[channel].users)
            elif len(nicks) == 2:
                irc.reply('Well, it\'s just been you two talking recently, so I\'m going to go ahead and just bomb someone at random from the whole channel')
                nicks = list(irc.state.channels[channel].users)
        elif len(nicks) == 0:
            nicks = list(irc.state.channels[channel].users)
        if irc.nick in nicks and not self.registryValue('allowSelfBombs', msg.args[0]):
            nicks.remove(irc.nick)
        #####
        #irc.reply('These people are eligible: %s' % utils.str.commaAndify(nicks))
        victim = self.rng.choice(nicks)
        while victim == self.lastBomb or victim in self.registryValue('exclusions', msg.args[0]):
            victim = self.rng.choice(nicks)
        self.lastBomb = victim
        detonateTime = self.rng.randint(self.registryValue('minRandombombTime', msg.args[0]), self.registryValue('maxRandombombTime', msg.args[0]))
        wireCount = self.rng.randint(self.registryValue('minWires', msg.args[0]), self.registryValue('maxWires', msg.args[0]))
        if wireCount < 12:
            colors = self.registryValue('shortcolors')
        else:
            colors = self.registryValue('colors')
        wires = self.rng.sample(colors, wireCount)
        goodWire = self.rng.choice(wires)
        self.log.info("TimeBomb: Safewire is %s"%goodWire)
        irc.queueMsg(ircmsgs.privmsg("##sgoutput", "TIMEBOMB: Safe wire is %s"%goodWire))
        self.bombs[channel] = self.Bomb(irc, victim, wires, detonateTime, goodWire, channel, msg.nick, self.registryValue('showArt', msg.args[0]), self.registryValue('showCorrectWire', msg.args[0]), self.registryValue('debug'))
        try:
            irc.noReply()
        except AttributeError:
            pass
开发者ID:antb,项目名称:StewieGriffin,代码行数:60,代码来源:plugin.py


示例18: getChanXXlyData

    def getChanXXlyData(self, chanName, type_):
        """Same as getChanGlobalData, but for the given
        year/month/day/dayofweek/hour.

        For example, getChanXXlyData('#test', 'hour') returns a list of 24
        getChanGlobalData-like tuples."""
        chanName = ircutils.toLower(chanName)
        sampleQuery = """SELECT SUM(lines), SUM(words), SUM(chars),
                         SUM(joins), SUM(parts), SUM(quits),
                         SUM(nicks), SUM(kickers), SUM(kickeds)
                         FROM chans_cache WHERE chan=? and %s=?"""
        min_, max_ = self.getChanRecordingTimeBoundaries(chanName)
        typeToIndex = {"year": 0, "month": 1, "day": 2, "dayofweek": 3, "hour": 4}
        if type_ not in typeToIndex:
            raise ValueError("Invalid type")
        min_ = min_[typeToIndex[type_]]
        max_ = max_[typeToIndex[type_]]
        results = {}
        for index in range(min_, max_ + 1):
            query = sampleQuery % (type_)
            cursor = self._conn.cursor()
            cursor.execute(query, (chanName, index))
            try:
                row = cursor.fetchone()
                assert row is not None
                if None in row:
                    row = tuple([0 for x in range(0, len(row))])
                results.update({index: row})
            except:
                self._addKeyInTmpCacheIfDoesNotExist(results, index)
            cursor.close()
        assert None not in results
        return results
开发者ID:GLolol,项目名称:ProgVal-Supybot-plugins,代码行数:33,代码来源:plugin.py


示例19: getChanRecordingTimeBoundaries

    def getChanRecordingTimeBoundaries(self, chanName):
        """Returns two tuples, containing the min and max values of each
        year/month/day/dayofweek/hour field.

        Note that this data comes from the cache, so they might be a bit
        outdated if DEBUG is False."""
        chanName = ircutils.toLower(chanName)
        cursor = self._conn.cursor()
        cursor.execute(
            """SELECT MIN(year), MIN(month), MIN(day),
                                 MIN(dayofweek), MIN(hour)
                          FROM chans_cache WHERE chan=?""",
            (chanName,),
        )
        min_ = cursor.fetchone()

        cursor = self._conn.cursor()
        cursor.execute(
            """SELECT MAX(year), MAX(month), MAX(day),
                                 MAX(dayofweek), MAX(hour)
                          FROM chans_cache WHERE chan=?""",
            (chanName,),
        )
        max_ = cursor.fetchone()

        if None in min_:
            min_ = tuple([int("0") for x in max_])
        if None in max_:
            max_ = tuple([int("0") for x in max_])
        assert None not in min_
        assert None not in max_
        return min_, max_
开发者ID:GLolol,项目名称:ProgVal-Supybot-plugins,代码行数:32,代码来源:plugin.py


示例20: doPrivmsg

 def doPrivmsg(self, irc, msg):
     channel = ircutils.toLower(msg.args[0])
     if not irc.isChannel(channel):
         return
     if callbacks.addressed(irc.nick, msg):
         return
     if channel in self.games:
         self.games[channel].answer(msg)
开发者ID:AlanBell,项目名称:Supybot-plugins,代码行数:8,代码来源:plugin.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ircutils.underline函数代码示例发布时间:2022-05-27
下一篇:
Python ircutils.stripFormatting函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap