python - on_raw_reaction_add() 每条消息只工作一次吗?
问题描述
所以我正在制作一个不和谐的机器人,其中机器人有一个列表,我希望用户能够做出反应来改变它。
到目前为止,这是我想出的。
@client.event
async def on_raw_reaction_add(payload):
global msg
global msg_id
global list_of_embeds
amount = 0
if payload.message_id == msg_id:
if payload.emoji.name == "➡️":
await msg.edit(embed=list_of_embeds[amount])
amount += 1
这只是我想要的真实代码的原型,但它不起作用。我第一次反应时它工作正常,但之后每次我不反应并再次反应时它都不会改变。msg 变量是包含消息的变量,msg_id 是包含消息 id 的变量,list_of_embeds 是包含我要发送的嵌入的列表。任何帮助,将不胜感激。
解决方案
推荐阅读
- redux - 使用 React / Redux 在特定情况下检索过滤后的数组长度
- reactjs - 多个导航栏 REACTJS
- python - 使用 Haarcascade 检测到的人脸,如何在不同颜色的相同人脸上绘制边界框
- python - 在 C++ 中估计嵌入式 python 脚本的进度
- javascript - 图像不在画布内旋转
- sql - 如何在分区级别查看分区表的 I/O 统计信息
- javascript - 我试图在单击按钮时禁用/启用下拉菜单
- python - Python 使用 DocxTemplate 填充 docx 表
- java - Android中的HTTPRequest线程
- visual-studio-code - 突出显示 VSCode 中的自定义代码部分