我有一个命令,您需要在其中 Ping/提及某人作为必需的 Arg,但是您将如何通过提及获得他们的用户 ID?
示例:
async def id(ctx, ping):
ctx.send(f"{ping}, your user id is {the person metioned's id}")
答案 0 :(得分:0)
试试这个:
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' 是一个 discord.Member