Python Bot use custom Emoji

徘徊边缘 提交于 2020-07-18 13:23:43

问题


How to make my bot use my custom emoji in any discord server.

@bot.command(pass_context=True)
async def ping(ctx):
    msg = "Pong :CustomEmoji: {0.author.mention}".format(ctx.message)
    await bot.say(msg)

Example: If I upload some custom emojis on server 1 and when we use the !ping command (mentioned above) in server 2 or server 3 or any server where the bot has access to, it should use the custom emoji. Result Pong with :CustomEmoji:


回答1:


From https://github.com/Rapptz/discord.py/issues/390:

It's <:emoji_name:emoji_id> for custom emojis.

You can also find the discord.Emoji instance through Server.emojis and then cast it to str.



来源:https://stackoverflow.com/questions/51982806/python-bot-use-custom-emoji

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