【问题标题】:How to add custom emoji to bot embed with nextcord如何将自定义表情符号添加到使用 nextcord 嵌入的机器人中
【发布时间】:2022-08-18 18:48:47
【问题描述】:

我正在使用 nextcord 创建一个不和谐机器人,其中一部分嵌入了一条消息。我想在嵌入中添加自定义表情符号,但似乎没有任何效果。 我当前的代码:

emoji = nextcord.Emoji(779407403804393512)
newEmbed.add_field(name = f\"{emoji}\" + \" Talismans ➜ \" + talismans, value = top_items_talismans, inline = False)


ERROR:
TypeError: Emoji.__init__() takes 1 positional argument but 2 were given

我尝试过的其他事情:

emoji = nextcord.Emoji(\"779407403804393512\")
/
emoji = nextcord.Emoji(\"fairysoul\", \"779407403804393512\")
/
emoji = nextcord.Emoji(name = \"fairysoul\", id = \"779407403804393512\")
/
#name of my bot initialization is bot
emoji = bot.get_emoji(id = \"fairysoul\", id = 779407403804393512)

还尝试了另一个帖子的修复:

from discord import Embed, Emoji
from discord.ext.commands import Bot

bot = Bot(command_prefix=\'!\')

@bot.command(pass_context=True)
async def debug(ctx, emoji: Emoji):
    embed = Embed(description=f\"emoji: {emoji}\", title=f\"emoji: {emoji}\")
    embed.add_field(name=\"id\", value=repr(emoji.id))
    embed.add_field(name=\"name\", value=repr(emoji.name))
    await bot.say(embed=embed)

bot.run(\"token\")

似乎没有任何工作,请帮助

PS:我正在使用nextcord,因为我在某处读到discord.py已停产,但我发现它已重新启动...切换到discord.py会更好吗?

    标签: python discord.py bots emoji nextcord


    【解决方案1】:

    切换到 discord.py 以修复您的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-05
      • 2021-03-25
      • 2019-01-29
      • 2021-04-28
      • 2021-05-06
      • 2015-02-20
      • 2021-03-21
      • 2022-01-24
      相关资源
      最近更新 更多