[英]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
您可以将检查表情符号直接放入 add_reaction,但我建议通过 unicode 表示添加反应:
await embedMsg.add_reaction('\N{WHITE HEAVY CHECK MARK}')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.