def isAdmin(reaction, user):
for i in admins:
if user.id == i: return (str(reaction.emoji) == '👍' or str(reaction.emoji) == '👎')
try: reaction, user = await self.bot.wait_for('reaction_add', timeout=43200, check=isAdmin)
except asyncio.TimeoutError: await msg.edit(embed=embedEnd)
else:
resign_channel = discord.utils.get(ctx.guild.channels, name="resignings")
if str(reaction.emoji) == '👍':
print('{}: {} resigned {} {}.'.format(extCalls.timeNow('datetime'), ctx.channel.category.name, firstName, lastName))
await msg.edit(embed=embedFin)
await resign_channel.send(embed=embedConf)
else: await msg.edit(embed=embedEnd)
这是我让机器人等待msg
上的反应的代码。但是,出于某种原因,当我有两条msg
(消息)同时等待反应时,当我对一条消息作出反应时,两条都会触发成功,即使我没有对第二条消息作出反应。这对于一个基于管理员的审批系统来说是一个很大的问题。。。有人知道为什么会发生这种情况或者如何解决吗
这段代码非常混乱,但如果您正在寻找一种只等待对一条消息的反应的方法,您应该在check命令中添加内容,例如:
相关问题 更多 >
编程相关推荐