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

Python plugins.getUserName函数代码示例

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

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



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

示例1: _formatMemo

 def _formatMemo(self, memo):
     user = plugins.getUserName(memo.by)
     L = [format('%s (added by %s at %t)', memo.text, user, memo.at)]
     for (at, by, text) in memo.appends:
         L.append(format('%s (appended by %s at %t)',
                         text, plugins.getUserName(by), at))
     sep = ircutils.bold(' :: ')
     return sep.join(L)
开发者ID:D0MF,项目名称:supybot-plugins-1,代码行数:8,代码来源:plugin.py


示例2: _formatNote

 def _formatNote(self, note, to):
     elapsed = utils.timeElapsed(time.time() - note.at)
     if note.to == to:
         author = plugins.getUserName(note.frm)
         return format("#%i: %s (Sent by %s %s ago)", note.id, note.text, author, elapsed)
     else:
         assert note.frm == to, "Odd, userid isn't frm either."
         recipient = plugins.getUserName(note.to)
         return format("#%i: %s (Sent to %s %s ago)", note.id, note.text, recipient, elapsed)
开发者ID:the1glorfindel,项目名称:PoohBot,代码行数:9,代码来源:plugin.py


示例3: _formatNoteId

 def _formatNoteId(self, msg, note, sent=False):
     if note.public or not ircutils.isChannel(msg.args[0]):
         if sent:
             sender = plugins.getUserName(note.to)
             return format('#%i to %s', note.id, sender)
         else:
             sender = plugins.getUserName(note.frm)
             return format('#%i from %s', note.id, sender)
     else:
         return format('#%i (private)', note.id)
开发者ID:Athemis,项目名称:Limnoria,代码行数:10,代码来源:plugin.py


示例4: __str__

 def __str__(self):
     grabber = plugins.getUserName(self.grabber)
     if self.at:
         return format(_('%s (Said by: %s; grabbed by %s at %t)'),
                       self.text, self.hostmask, grabber, self.at)
     else:
         return format('%s', self.text)
开发者ID:ElectroCode,项目名称:Limnoria,代码行数:7,代码来源:plugin.py


示例5: factinfo

    def factinfo(self, irc, msg, args, channel, key):
        """[<channel>] <factoid key>

        Returns the various bits of info on the factoid for the given key.
        <channel> is only necessary if the message isn't sent in the channel
        itself.
        """
        # Start building the response string
        s = key + ": "
        # Next, get all the info and build the response piece by piece
        info = self.db.getFactinfo(channel, key)
        if not info:
            irc.error(format(_("No such factoid: %q"), key))
            return
        (
            created_by,
            created_at,
            modified_by,
            modified_at,
            last_requested_by,
            last_requested_at,
            requested_count,
            locked_by,
            locked_at,
        ) = info
        # First, creation info.
        # Map the integer created_by to the username
        created_by = plugins.getUserName(created_by)
        created_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(created_at)))
        s += format(_("Created by %s on %s."), created_by, created_at)
        # Next, modification info, if any.
        if modified_by is not None:
            modified_by = plugins.getUserName(modified_by)
            modified_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(modified_at)))
            s += format(_(" Last modified by %s on %s."), modified_by, modified_at)
        # Next, last requested info, if any
        if last_requested_by is not None:
            last_by = last_requested_by  # not an int user id
            last_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(last_requested_at)))
            req_count = requested_count
            s += format(_(" Last requested by %s on %s, requested %n."), last_by, last_at, (requested_count, "time"))
        # Last, locked info
        if locked_at is not None:
            lock_at = time.strftime(conf.supybot.reply.format.time(), time.localtime(int(locked_at)))
            lock_by = plugins.getUserName(locked_by)
            s += format(_(" Locked by %s on %s."), lock_by, lock_at)
        irc.reply(s)
开发者ID:Hoaas,项目名称:Limnoria,代码行数:47,代码来源:plugin.py


示例6: _mostAuthored

 def _mostAuthored(self, irc, channel, limit):
     results = self.db.mostAuthored(channel, limit)
     L = ["%s (%s)" % (plugins.getUserName(t[0]), int(t[1])) for t in results]
     if L:
         author = _("author")
         if len(L) != 1:
             author = _("authors")
         irc.reply(format(_("Most prolific %s: %L"), author, L))
     else:
         irc.error(_("There are no factoids in my database."))
开发者ID:Hoaas,项目名称:Limnoria,代码行数:10,代码来源:plugin.py


示例7: _mostAuthored

 def _mostAuthored(self, irc, channel, limit):
     results = self.db.mostAuthored(channel, limit)
     L = ['%s (%s)' % (plugins.getUserName(t[0]), int(t[1]))
          for t in results]
     if L:
         author = 'author'
         if len(L) != 1:
             author = 'authors'
         irc.reply(format('Most prolific %s: %L', author, L))
     else:
         irc.error('There are no factoids in my database.')
开发者ID:Kefkius,项目名称:mazabot,代码行数:11,代码来源:plugin.py


示例8: __str__

 def __str__(self):
     user = plugins.getUserName(self.by)
     if self.options:
         options = format('Options: %s', '; '.join(map(str, self.options)))
     else:
         options = 'The poll has no options, yet'
     if self.status:
         status = 'open'
     else:
         status = 'closed'
     return format('Poll #%i: %q started by %s. %s.  Poll is %s.',
                   self.id, self.question, user, options, status)
开发者ID:Latinx,项目名称:supybot,代码行数:12,代码来源:plugin.py


示例9: __str__

 def __str__(self):
     user = plugins.getUserName(self.by)
     if self.expires == 0:
         s = format('%s (Subject: %q, added by %s on %s)',
                    self.text, self.subject, self.by,
                    utils.str.timestamp(self.at))
     else:
         s = format('%s (Subject: %q, added by %s on %s, '
                    'expires at %s)',
                    self.text, self.subject, user,
                    utils.str.timestamp(self.at),
                    utils.str.timestamp(self.expires))
     return s
开发者ID:Criptomonedas,项目名称:supybot_fixes,代码行数:13,代码来源:plugin.py


示例10: results

 def results(self, channel, poll_id):
     db = self._getDb(channel)
     cursor = db.cursor()
     cursor.execute("""SELECT id, question, started_by, open
                       FROM polls WHERE id=%s""",
                       poll_id)
     if cursor.rowcount == 0:
         raise dbi.NoRecordError
     (id, question, by, status) = cursor.fetchone()
     by = plugins.getUserName(by)
     cursor.execute("""SELECT count(user_id), option_id
                       FROM votes
                       WHERE poll_id=%s
                       GROUP BY option_id
                       UNION
                       SELECT 0, id AS option_id
                       FROM options
                       WHERE poll_id=%s
                       AND id NOT IN (
                             SELECT option_id FROM votes
                             WHERE poll_id=%s)
                       GROUP BY option_id
                       ORDER BY count(user_id) DESC""",
                       poll_id, poll_id, poll_id)
     if cursor.rowcount == 0:
         raise PollError, 'This poll has no votes yet.'
     else:
         options = []
         for count, option_id in cursor.fetchall():
             cursor.execute("""SELECT option FROM options
                               WHERE id=%s AND poll_id=%s""",
                               option_id, poll_id)
             option = cursor.fetchone()[0]
             options.append(OptionRecord(option_id, votes=int(count),
                                         text=option))
     return PollRecord(poll_id, question=question, status=status, by=by,
                       options=options)
开发者ID:Latinx,项目名称:supybot,代码行数:37,代码来源:plugin.py


示例11: __str__

 def __str__(self):
     grabber = plugins.getUserName(self.grabber)
     return format('%s (Said by: %s; grabbed by %s at %t)',
                   self.text, self.hostmask, grabber, float(self.at))
开发者ID:jreese,项目名称:supybot-plugins,代码行数:4,代码来源:plugin.py


示例12: __str__

 def __str__(self):
     at = time.strftime(conf.supybot.reply.format.time(),
                        time.localtime(float(self.at)))
     grabber = plugins.getUserName(self.grabber)
     return '%s (Said by: %s; grabbed by %s at %s)' % \
               (self.text, self.hostmask, grabber, at)
开发者ID:nod,项目名称:boombot,代码行数:6,代码来源:plugin.py


示例13: __str__

 def __str__(self):
     grabber = plugins.getUserName(self.grabber).split('!', 2)
     return format('%s grabbed: %s',
                   grabber[0], self.text)
开发者ID:Wintervenom,项目名称:Xn,代码行数:4,代码来源:plugin.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python plugins.makeChannelFilename函数代码示例发布时间:2022-05-27
下一篇:
Python plugins.getChannel函数代码示例发布时间: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