Python 如何检查在我的机器人上使用命令的人的用户ID

Python 如何检查在我的机器人上使用命令的人的用户ID,python,command,discord.py,discord.py-rewrite,Python,Command,Discord.py,Discord.py Rewrite,当有人对我的discord bot(discord.py)使用命令时,我想检查他们的用户ID,如果它等于我的,那么它会回复hello并显示我的排名。但这行不通,有什么想法吗 这是我目前的代码: class rank(commands.Cog): def __init__(self, client): self.client = client @commands.command(aliases=["perms"]) async def rank(self,

当有人对我的discord bot(discord.py)使用命令时,我想检查他们的用户ID,如果它等于我的,那么它会回复hello并显示我的排名。但这行不通,有什么想法吗

这是我目前的代码:

class rank(commands.Cog):
    def __init__(self, client):
        self.client = client

    @commands.command(aliases=["perms"])
    async def rank(self, ctx, member):
        if client.author.id == xxxx:
            await ctx.send(f"Your rank is Bot Owner..\nHello Chaseyy")
            return
        elif client.author.id == xx:
            await ctx.send("Your rank is Bot Admin\nHello Name")
            return
        else:
            await ctx.send("You are a Bot User")
        return

您可以执行以下操作来检索消息的用户id:

ctx.author.id
ctx
参数包含有关发送消息的所有信息。使用:
ctx.author
我们检索用户。使用
ctx.author.id
我们检索该用户的id