Discord.py 如何在不将id放在服务器命令后的情况下提及用户

Discord.py 如何在不将id放在服务器命令后的情况下提及用户,discord.py,Discord.py,我每次都要做#status[user id],有没有办法让它成为#status only?在命令中获取成员对象的最简单方法之一,允许您使用用户的id、名称等,就是使用它们提供的转换器 @client.command() 异步def测试(当前,成员:discord.member=None): 如果成员==无:#如果未提供成员。。 member=current.author#…使成员成为作者 等待当前。发送(f“Hello{member.notice}!”) 其他类似的问题: 您现在已经是

我每次都要做#status[user id],有没有办法让它成为#status only?

在命令中获取成员对象的最简单方法之一,允许您使用用户的id、名称等,就是使用它们提供的转换器

@client.command()
异步def测试(当前,成员:discord.member=None):
如果成员==无:#如果未提供成员。。
member=current.author#…使成员成为作者
等待当前。发送(f“Hello{member.notice}!”)

其他类似的问题


您现在已经是第三次问这个问题了,为什么不等到您在另一个问题下得到帮助呢?
@client.command()
async def status(current, content: str):
    status = None
    for member in current.guild.members:
        if str(member.id) == content:
            status = member.status
            break
    if status == discord.Status.online:
        online_embed = discord.Embed(
            title="awa is online", description="", color=0xF6E5E5
        )
        await current.send(embed=online_embed)