trainerdex.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:TrainerDex-RedCog 作者: TrainerDex 项目源码 文件源码
def profileCard(self, name: str, force=False):
        try:
            trainer = await self.get_trainer(username=name)
        except LookupError:
            raise
        if not trainer:
            raise LookupError("Trainer not found")
        account = trainer.owner()
        discordUser = account.discord()[0]
        level=trainer.level

        embed=discord.Embed(timestamp=trainer.update.update_time, colour=int(trainer.team().colour.replace("#", ""), 16))
        try:
            embed.set_author(name=trainer.username, icon_url=discordUser.avatar_url)
        except:
            embed.set_author(name=trainer.username)
        if account and (account.first_name or account.last_name) and trainer.cheater is False:
            embed.add_field(name='Name', value=account.first_name+' '+account.last_name)
        embed.add_field(name='Team', value=trainer.team().name)
        embed.add_field(name='Level', value=level.level)
        if level.level != 40:
            embed.add_field(name='XP', value='{:,} / {:,}'.format(trainer.update.xp-level.total_xp,level.xp_required))
        else:
            embed.add_field(name='Total XP', value='{}'.format(humanize.intword(trainer.update.xp)))
        if discordUser:
            embed.add_field(name='Discord', value='<@{}>'.format(discordUser.id))
        if trainer.cheater is True:
            desc = "{} has been known to cheat."
            embed.description = desc.format(trainer.username)
        embed.set_footer(text="Total XP: {:,}".format(trainer.update.xp))
        return embed
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号