【发布时间】: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