【发布时间】:2021-04-30 18:27:44
【问题描述】:
我有一个事件等待消息下的反应。但是,如果一旦这个事件被丢弃,机器人就会失败,然后如果你点击反应,机器人就没有反应,因为他无法捕捉到这个反应。有没有另一种方法可以让机器人继续运行?
我不喜欢使用timeout 事件或asyncio.sleep,因为输入应该来自用户。这可能吗?
到目前为止我的代码没有解决方法:
try:
reaction, user = await self.bot.wait_for('reaction_add', timeout=43200)
while user == self.bot.user:
reaction, user = await self.bot.wait_for('reaction_add', timeout=43200)
if str(reaction.emoji) == "⏯":
await ctx.send("**Your next question will appear in `6` seconds.**", delete_after=5)
await intense.delete()
except asyncio.TimeoutError:
await ctx.send("**Really?! I though `12 hours` would be enough..."
"Your next question will come in about `6` seconds.**", delete_after=5)
await asyncio.sleep(6)
【问题讨论】:
标签: python discord discord.py