繁体   English   中英

无法在嵌入消息的标题中标记成员 discord.py

[英]unable to tag members in embed message's title discord.py

我的 discord 机器人应该在包含 GIF 的嵌入中标记人。 我使用以下代码来提及:

embed = discord.Embed(title = f"{member.mention}, I'm sorry...")

但是,我没有标记成员,而是获得了 ID:屏幕截图

Alkes02 的回答不是真的。

您可以在嵌入中标记(他们不会收到通知)人。

从我的机器人中查看下图: https://gyazo.com/118f0251798afd32bdd23d806c694544

我相信您只需获取消息的作者并在.mention的末尾添加一个 .mention。

for user in board:
    description += f"**{board.index(user) + 1}.** {user[0].mention} | Level: {user[1]} | 
                   XP: {user[2]}\n"
msg = discord.Embed(
    color=discord.Color.green(),
    title=f"{str(ctx.guild)}" "s Valley Leaderboard",
    description=description,
)

await ctx.send(embed=msg)

您不能在标题上提及用户,只能在描述上提及。 看一个例子:

@client.command()
async def pollyn(ctx, *, title):
##  ##
await ctx.message.add_reaction('👍')
embed = discord.Embed(title=title, description=f"{ctx.author.mention} iniciou uma votação.", color=0xff5555)
message = await ctx.send(embed=embed)
await message.add_reaction('👍')
await message.add_reaction('👎')
await message.add_reaction('🤷‍♂️')
return 
##  ##

您不能在嵌入中提及人员。 如果您希望对成员进行 ping,则必须在消息之前或之后在普通消息中 ping 他们。

您不能在嵌入的标题/页脚中提及。

其他部分工作,但提及仍然没有 ping 用户。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM