如何让我的 discord 机器人对表情符号做出反应

How do I make my discord bot react with an emoji

我已经尝试了所有该死的东西,我无法让它工作。我希望机器人在我编写命令时对嵌入的复选标记作出反应,但是我尝试过的所有操作都会出现此字符串错误。我现在已经尝试了 2 个小时,但没有成功。请帮我。我正在使用 discord.py.

@client.command()
async def verification(ctx):
    
    verifyEmbed = discord.Embed(
        title="VERIFY",
        description="To get access to the server you need to verify. \nVerify by reacting with :white_check_mark: \n\n ",
        color=discord.Colour.green()
    )

    embedMsg = await ctx.send(embed=verifyEmbed)
    checkM = client.get_emoji("✅")
    await embedMsg.add_reaction(checkM)

错误信息:

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: emoji argument must be str, Emoji, or Reaction not NoneType.

get_emoji 用于通过 ID 获取表情符号,因此它返回 None,这会导致您在 add_reaction

中出现错误

您可以直接将检查表情符号放入 add_reaction,但我建议使用 unicode 表示添加反应:

await embedMsg.add_reaction('\N{WHITE HEAVY CHECK MARK}')