Custom Emoji's and Animated Emoji's not working [discord.py-rewrite]

点点圈 提交于 2021-01-20 11:33:55

问题


I recently built a simple command to test the format of custom emoji's and animated emoji's

Here is what the command was

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

But the output message didn't send the custom emoji, instead it messaged

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

Any help will be appreciated.


回答1:


You can use Client.get_emoji to get the Emoji object, then use that to build your string

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


来源:https://stackoverflow.com/questions/54085674/custom-emojis-and-animated-emojis-not-working-discord-py-rewrite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!