我正在编写一个自定义帮助命令,该命令将嵌入的DM发送给用户,一切正常。作为命令的一部分,我试图使bot对命令消息做出反应,但我无法使其正常工作,我已经阅读了文档,但似乎仍然无法使其作为命令的一部分做出反应。以下是我要实现的目标:
@client.command(pass_context=True)
async def help(ctx):
# React to the message
author = ctx.message.author
help_e = discord.Embed(
colour=discord.Colour.orange()
)
help_e.set_author(name='The bot\'s prefix is !')
help_e.add_field(name='!latency', value='Displayes the latency of the bot', inline=False)
help_e.add_field(name='!owo, !uwu, !rawr', value='Blursed commands', inline=False)
await author.send(embed=help_e)```
答案 0 :(得分:0)
您可以使用message.add_reaction()
,也可以使用ctx.message
向邮件添加响应。这是您可以做的:
@client.command(pass_context=True)
async def help(ctx):
# React to the message
await ctx.message.add_reaction('✅')
author = ctx.message.author
help_e = discord.Embed(
colour=discord.Colour.orange()
)
help_e.set_author(name='The bot\'s prefix is !')
help_e.add_field(name='!latency', value='Displayes the latency of the bot', inline=False)
help_e.add_field(name='!owo, !uwu, !rawr', value='Blursed commands', inline=False)
sent_embed = await author.send(embed=help_e)