vote_msg = await ctx.send(embed=embed)
await vote_msg.add_reaction('✅')
await vote_msg.add_reaction('❎')
reaction, member = await ctx.bot.wait_for('reaction_add')
vote_msg = await vote_msg.channel.fetch_message(vote_msg.id) # refetch message
# default values
positive = 0
negative = 0
for reaction in vote_msg.reactions:
if reaction.emoji == '✅':
positive = reaction.count - 1
elif reaction.emoji == '❎':
negative = reaction.count - 1
print(positive)
print(negative)
当前,我有这个功能来重新获得消息的反应,我该如何制作它,以便在某人第一次做出反应后重新获得消息,而不是等待5秒钟进行检查?
答案 0 :(得分:0)
我认为您正在寻找on_reaction listener
您可以从react.message.reactions访问所有消息反应 如下:
@bot.event
async def on_reaction_add(reaction, user):
reactions = reaction.message.reactions
# DO WHAT YOU WANT HERE