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
评论列表
文章目录