coins.py 文件源码

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

项目:jose 作者: lnmds 项目源码 文件源码
def ranks(self, user_id: int, guild: discord.Guild) -> tuple:
        """Get ranking data about a user."""
        all_accounts = await self.all_accounts()

        all_ids = [account['id'] for account in all_accounts]

        guild_ids = [account['id'] for account in all_accounts if
                     guild.get_member(account['id']) is not None]

        try:
            guildrank = guild_ids.index(user_id) + 1
        except ValueError:
            guildrank = -20

        globalrank = all_ids.index(user_id) + 1

        return guildrank, globalrank, len(guild_ids), len(all_ids)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号