How do you have a Discord bot remove a user reaction to a message in discord.py?(你如何让 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
或 Reaction.remove
.
You can use either Message.remove_reaction
or Reaction.remove
.
Reaction 对象表示对Message,因此如果您拥有的 Reaction 对象不是用于表情符号反应您要删除的,使用 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 中消息的反应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:你如何让 Discord 机器人删除用户对 discord.py 中消息的反应?


基础教程推荐
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 筛选NumPy数组 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01