您如何让Discord机器人删除用户对discord.py中消息的反应? [英] How do you have a Discord bot remove a user reaction to a message in discord.py?

查看:95
本文介绍了您如何让Discord机器人删除用户对discord.py中消息的反应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 @ client.event 并使用 async def on_raw_reaction_add(payload):来读取Discord反应事件.当我的代码中的标志之一失败时,我需要能够删除用户的响应.我在文档中看到有 await remove(user),但是我认为我使用的不正确.有什么建议吗?

I'm using an @client.event and using async def on_raw_reaction_add(payload): to read Discord reaction events. I need to be able to delete a user reaction when they fail one of the flags in my code. I saw in the documentation that there is await remove(user) but I don't think I'm using it right. Any suggestions?

推荐答案

您可以使用 Message.remove_reaction

You can use either Message.remove_reaction or Reaction.remove.

反应对象表示对消息,因此,如果您拥有的Response对象不是表情符号反应要删除的对象,请使用 Reaction.remove 尝试删除错误的表情符号反应.

A Reaction object represents a specific emoji reaction to a Message, so if the Reaction object you have is not for the emoji reaction that you want to remove, using Reaction.remove will attempt to remove the wrong emoji reaction.

这篇关于您如何让Discord机器人删除用户对discord.py中消息的反应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆