首页 > 解决方案 > 用 python 在 Discord 上标记某人

问题描述

这是我第一次在 Discord 上制作机器人,我想在我的频道上标记一个成员,并在其中添加一条消息。我的代码是这样的:

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('|bro'):
        await message.channel.send("You are dumb" + the member)

消息应该是这样的:"You are dumb @themember"

标签: pythondiscord.py

解决方案


如果您想 ping 作者,只需message.author.mention在您的回复中包含。

“.mention”会 ping 用户,就像您使用 @ 符号一样。


推荐阅读