python - 自定义表情符号和动画表情符号不起作用 [discord.py-rewrite]

标签 python discord discord.py

我最近构建了一个简单的命令来测试自定义表情符号和动画表情符号的格式

这是命令的内容

@bot.command()
async def say(ctx, *, text):
await ctx.send("<:ono:521148278079881219> You said %s" % text)

但是输出消息没有发送自定义表情符号,而是发送了消息

:ono: You said hello(the text i messaged in chat)

任何帮助将不胜感激。

最佳答案

您可以使用Client.get_emoji获取 Emoji 对象,然后使用它来构建字符串

@bot.command()
async def say(ctx, *, text):
    ono = bot.get_emoji(521148278079881219)
    await ctx.send(f"{ono} You said {text}")

关于python - 自定义表情符号和动画表情符号不起作用 [discord.py-rewrite],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54085674/

相关文章:

python - 从 Pandas 数据框制作多个饼图(每行一个)

c# - 在 C# 或 Unity 中执行 Python 脚本

javascript - 如何向特定的discord channel 发送消息?

Python discord bot - 从未等待过协程

python - 如何在 IPython 5 提示符中包含您的主机名?

javascript - Discord.js 中的头像命令未提及

javascript - 从 DM 向用户添加角色?

python - Discord bot 未按名称查找 channel

python - 如何在 discord.py 中提及用户?

python - 空心圆符号中的误差线