python - 无法在嵌入消息的标题 discord.py 中标记成员
问题描述
我的不和谐机器人应该在包含 GIF 的嵌入中标记人。我使用以下代码来提及:
embed = discord.Embed(title = f"{member.mention}, I'm sorry...")
但是,我没有标记成员,而是获得了 ID:屏幕截图
解决方案
Alkes02 的回答不是真的。
您可以在嵌入中标记(他们不会收到通知)人。
从我的机器人中查看下图: https ://gyazo.com/118f0251798afd32bdd23d806c694544
我相信您只需获取消息的作者并将 a 添加.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)
推荐阅读
- javascript - 想在change中调用两个函数并且无法传递事件
- javascript - 附加一个尾部选择选项来维护功能
- javascript - 出现错误:文本字符串必须在
零件 - dig - 是否有 dig 命令可以将记录添加到 dns 服务器?
- javascript - 如何在字段更新时选中复选框
- android - AudioRecord 计算幅度
- excel - 将单元格的值从多个工作簿复制到主文件
- javascript - 调用路由时如何传递变量?
- java - Spring - @Cacheable 注释不适用于 java 方法
- couchbase - 如何在使用 couchbase 子文档 api 执行更新时获取 CAS 值?