如何使我的不和谐机器人与表情符号反应

时间:2020-09-15 17:44:35

标签: python discord.py discord.py-rewrite

我已经尝试了所有该死的东西,但我无法使它正常工作。我希望机器人在编写命令时对嵌入内容打勾,但是我尝试的所有操作都得到此字符串错误。我已经尝试了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.

1 个答案:

答案 0 :(得分:0)

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

您可以直接将检查表情符号放入add_reaction中,但我建议以unicode表示形式添加响应:

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