gpt4 book ai didi

Python Bot 使用自定义表情符号

转载 作者:行者123 更新时间:2023-12-04 19:27:24 25 4
gpt4 key购买 nike

如何让我的机器人在任何 Discord 服务器中使用我的自定义表情符号。

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

例子:
如果我在 server 1 上传一些自定义表情符号当我们使用 !ping server 2 中的命令(如上所述)或 server 3或机器人可以访问的任何服务器,它应该使用自定义表情符号。
结果 Pong with :CustomEmoji:

最佳答案

来自 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 andthen cast it to str.

关于Python Bot 使用自定义表情符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51982806/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com