@提及随机用户discord.py



Hy大家好,所以我一直在尝试写一个代码,其中discord bot提到我的服务器上的随机用户,我已经写了代码,但bot一直提到自己

from random import choice
@client.command(pass_context=True)
async def best(ctx):
user = choice(ctx.message.channel.guild.members)
await ctx.send(f'{user.mention} is the best player')

您必须放置random.choice而不是选择

user = random.choice(ctx.message.channel.guild.members)

random.choice将选择一个随机用户。选择什么都不做

最新更新