使 discord python 重写 bot 标签消息作者

Make discord python rewrite bot tag message author

我正在更新一个用 Discord.py 制作的旧机器人,但我无法像以前那样用它来标记人们。

if 'test' in message.content:
            msg = f'test sucessful {.author}'
            await message.channel.send(msg)

在 discord 重写文档中,我发现的唯一示例是 {.author},但它不起作用。它会打印用户名,例如 person#1234,但不会标记它们。

有多种标记用户的方法 - 它们是等价的:


例子

await message.channel.send(f"Test successful, {message.author.mention}!")
await message.channel.send(f"Test successful, <@{message.author.id}>!")