Python Bot使用自定义表情符号 [英] Python Bot use custom Emoji
问题描述
如何使我的机器人在任何不和谐的服务器中使用我的自定义表情符号。
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)
示例:
如果我在服务器1上上传了一些自定义表情符号
以及在服务器2
或<$ c中使用!ping
命令(如上所述)时$ c>服务器3 或漫游器有权访问的任何服务器,都应使用自定义表情符号。
结果 Pong与:CustomEmoji:
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:
推荐答案
来自< a href = https://github.com/Rapptz/discord.py/issues/390 rel = nofollow noreferrer> https://github.com/Rapptz/discord.py/issues/390 :
自定义表情符号是
<:emoji_name:emoji_id>
。
您还可以通过Server.emojis和
找到discord.Emoji实例,然后将其转换为str。
You can also find the discord.Emoji instance through Server.emojis and then cast it to str.
这篇关于Python Bot使用自定义表情符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!