python - 如何将自定义表情符号添加到嵌入式消息中?
问题描述
我做了什么:
我试图在我的嵌入中添加自定义表情符号。然而,这并没有成功。也许我正在使用过时的代码?我不确定究竟是什么导致它不起作用。我没有从控制台得到任何反馈,我的所有其他命令都有效。
@bot.command()
async def react(ctx):
channel = bot.get_channel(865698553737117696)
firework = get(ctx.message.server.emojis, name="firework")
phone = get(ctx.message.server.emojis, name= "socials")
react = discord.Embed(title = 'Reaction Roles:',description = 'Below are a range of reaction roles that allows you to be pinged when we announce something exciting:\n',colour = 0xE23D6E)
react.set_author(name='Disney Dreams', icon_url= 'https://cdn.discordapp.com/attachments/809937571793993730/866327668970881034/logogoosggs.png')
react.add_field(name='**Shows**', value=f'{firework}' + ': Allows you to get pinged when we make an announcement relating to shows here at Disney Dreams', inline= False)
react.add_field(name='**Social Media**',
value=f'{phone}' + ': Allows you to get pinged when we make a post on one of our social media pages', inline=False)
reactions = await channel.send(embed=react)
await reactions.add_reaction(':firework:')
await reactions.add_reaction(':socials:')
解决方案
是的,你用来获取表情符号的方式已经过时了。要做到这一点非常简单。
<a:emojiname:emojiid>
您可以替换emojiname
为表情符号的名称和emojiid
表情符号 ID。您只需<a:emojiname:emojiid>
输入不和谐频道即可轻松获得\emoji
,该消息会将其格式化为您需要的格式。当然emoji
,\emoji
用实际的表情符号代替。
仅<a:emojiname:emojiid>
用于动画表情符号
要用于普通表情符号或静态表情符号,请使用<:emojiname:emojiid>
推荐阅读
- android-studio - 如何在 android studio 应用程序中添加可以运行 3rd 方软件的模拟器?
- laravel - Laravel Valet 504 Gateway Time-out nginx/1.19.6 after 60 seconds
- flutter - 输入'未来
' 不是类型 '((GetXState ) => 无效)? - swift - Swift 泛型函数类型排序
- python - Groupby 的 Python 最小/最大日期
- javascript - 数组上的 useTransition 返回未定义的数组属性(React Spring)
- spring - 如何为 spring GatewayFilter 测试生成取消的请求?
- excel - 快速/高效的 VBA 代码,用于比较大型数据库(约 9000 行)的 excel 中的两列
- debugging - 我可以阻止 STMCubeIDE 在微控制器复位(调试)时打开启动 .s 文件吗?
- python - 使用 pymssql 连接数据库时遇到问题