如何通过Ping获取用户ID



我有一个命令,你需要Ping/提及某人作为必需的Arg,但你如何通过提及获得他们的userid?

示例:

async def id(ctx, ping):
ctx.send(f"{ping}, your user id is {the person metioned's id}")

试试这个:

async def id(ctx, ping: discord.Member = None): # Assuming that 'ping' is a user you are mentioning
await ctx.send(f"{ping.mention}, your user id is {ping.id}")

这是假设论点"ping"是不和谐的。会员

最新更新