【发布时间】:2021-01-31 08:09:10
【问题描述】:
我正在尝试为我的机器人等待多个事件,我确实找到了一种方法并且它起作用了,但是突然间它无缘无故地崩溃了,没有错误
while True:
done, pending = await asyncio.wait(
[
bot.wait_for("raw_reaction_add")
bot.wait_for("raw_reacion_remove")
]
)
payload = done.pop().result()
if payload.event_type == "REACTION_ADD":
...
elif payload.event_type == "REACTION_REMOVE":
...
for future in pending:
future.cancel()
在我的主命令中这样做是行不通的,但我做了一个测试命令,一切都是一样的,它工作没有问题
【问题讨论】:
-
你可以使用 on_reaction_add 事件吗?
-
这是在命令中,bot事件不同
标签: python python-3.x discord.py python-asyncio discord.py-rewrite