discord.ext.command.errors.CommandNotFound:找不到命令"rank"



我不确定是不是我正在尝试调用一个decorator而它没有返回。我知道问题出在第二或第三条线上。

@commands.command()
async def rank(self, ctx, rank):
await ctx.send(rank)
if ctx.channel.id == bot_channel:
stats = leveling.find_one({"id" : ctx.author.id})
if stats is None:
embed = discord.Embed(description="You have't sent any messages, no rank!!!")
await ctx.channel.send(embed=embed)
else:
xp = stats["xp"]
lvl = 0
rank = 0
while True:
if xp < ((50*(lvl**2))+(50*lvl)):
break
lvl += 1
xp -= (50 * (lvl - 1) ** 2) + (50 * (lvl - 1))
boxes = int((xp/(200*((1/2) * lvl))*20))
rankings = leveling.find().sort("xp",-1)
for x in rankings:
rank += 1
if stats["id"] == x["id"]:
break
embed = discord.Embed(title="{}'s level stats".format(ctx.author.name))
embed.add_field(name="Name", value=ctx.author.mention, inline=True)
embed.add_field(name="XP", value=f"{xp}/{int(200*((1/2)*lvl))}", inline=True)
embed.add_field(name="Rank", value=f"{rank}/{ctx.guild.member_count}", inline=True)
embed.add_field(name="Progress Bar [lvl", value=boxes * ":blue_square:" + (20-boxes) * ":white_large_square", inline=False)
embed.set_thumbnail(url=ctx.author.avatar_url)
await ctx.channel.send(embed=embed)"

通常重新启动你的机器人程序可以解决这个问题;但是,如果它仍然存在,请仔细检查中是否没有索引和cog 的命令

最新更新