关卡系统,用户名不找回

时间:2021-04-09 12:13:44

标签: mongodb discord.py

   @commands.command()
    async def lboard(self, ctx):
        if (ctx.channel.id == bot_channel):
            rankings = leveling.find().sort("xp",-1)
            i = 1
            embed = discord.Embed(title="Rankings")
            for x in rankings:
                temp = ctx.guild.get_member(x['id'])
                tempxp = x["xp"]
                embed.add_field(name=f'{i}: {temp}', value=f'Total XP: {tempxp}', inline=False)
                i += 1
                if i == 5:
                    break
            await ctx.send(embed=embed)

无法获取用户,它检索为 None。如果我添加 {temp.name} AttributeError: 'NoneType' object has no attribute 'name'

使用MongoDB

0 个答案:

没有答案