正在更新一个用 Discord.py 制作的旧机器人,但我无法让它像以前那样标记人。
if 'test' in message.content:
msg = f'test sucessful {.author}'
await message.channel.send(msg)
在不和谐重写文档中,我找到的唯一示例是 {.author},但它不起作用。它确实打印用户名,如person#1234,但不标记它们。
标记用户有不同的方法 - 它们是等效的:
<小时 />示例
await message.channel.send(f"Test successful, {message.author.mention}!")
await message.channel.send(f"Test successful, <@{message.author.id}>!")