我不知道这个代码有什么问题。我没有成功,我是从Github获得的,它总是输出相同的用户。我找了Python Discord的人帮忙。他们无法测试,但最终得到:
@bot.command(name="leaderboard", brief="richest users list", description="list all of the richest users from richest to poorest.")
async def leaderboard(ctx):
users = db.keys()
total = {}
for user in users:
total[user] += db[f"{user}"]
total = sorted(total.items(), key=lambda x: x[1], reverse=True)
await ctx.send("the top 5 richest users are...")
for count, amt in enumerate(total, start=1):
await ctx.send(f"{count}. {amt} {total[amt]}")
我不知道发生了什么,为什么它没有输出任何东西。请帮忙
目前没有回答
相关问题 更多 >
编程相关推荐