如何让 discord bot 对用户的命令消息做出反应?
How to make the discord bot react to the user's command message?
@commands.command(name='clear', aliases=['clean', 'cleanup'])
@commands.guild_only()
@commands.has_permissions(manage_messages=True)
async def clear(self, ctx, message, limit: int = 10) -> None:
await ctx.message.add_reaction(":white_check_mark:")
messages = await ctx.channel.purge(bulk=True, limit=limit)
embed=discord.Embed(title=f"`{len(messages)}` mensagens deletadas com sucesso", color=COR_PRINCIPAL)
embed.set_author(name="Plugin de comandos do Tatrantolo",icon_url=ICONE)
await ctx.send(embed=embed, delete_after=5)
我希望机器人对用户的消息添加反应,但它似乎不起作用。我做错了什么?
当使用 standart discord 表情符号时,您必须对字符的 unicode 做出反应,以简单地获取它 \{emoji}
,发送它并复制表情符号。在你的情况下,表情符号的 unicode 是 ✅。
await ctx.message.add_reaction('✅')
编辑:
@commands.command()
async def testing(self, ctx):
await ctx.message.add_reaction('✅')
@commands.command(name='clear', aliases=['clean', 'cleanup'])
@commands.guild_only()
@commands.has_permissions(manage_messages=True)
async def clear(self, ctx, message, limit: int = 10) -> None:
await ctx.message.add_reaction(":white_check_mark:")
messages = await ctx.channel.purge(bulk=True, limit=limit)
embed=discord.Embed(title=f"`{len(messages)}` mensagens deletadas com sucesso", color=COR_PRINCIPAL)
embed.set_author(name="Plugin de comandos do Tatrantolo",icon_url=ICONE)
await ctx.send(embed=embed, delete_after=5)
我希望机器人对用户的消息添加反应,但它似乎不起作用。我做错了什么?
当使用 standart discord 表情符号时,您必须对字符的 unicode 做出反应,以简单地获取它 \{emoji}
,发送它并复制表情符号。在你的情况下,表情符号的 unicode 是 ✅。
await ctx.message.add_reaction('✅')
编辑:
@commands.command()
async def testing(self, ctx):
await ctx.message.add_reaction('✅')