我正在做一个投票机器人,现在我想知道如何计算反应并找到赢家的答案,我已经尝试了很多,但我无法做到这一点。有人知道吗
embed = discord.Embed(title="¡Es momento de tomar una encuesta!", colour=discord.Colour(0x3e038c))
embed.add_field(name='Autor de la encuesta', value=f'{ctx.author}')
embed.add_field(name='Pregunta:', value=f'{pregunta}')
msg = await ctx.send(embed=embed)
await msg.add_reaction(str('🔺'))
await msg.add_reaction(str('🔻'))
要实现您想要的,您只需要检查
message.reactions
参数的length
例如:
在检查投票获胜者的命令中,您首先需要检索投票的消息\u id,然后将其作为参数传递给您的命令,以便检索
message
对象并查找附加到它的反应参考资料:
相关问题 更多 >
编程相关推荐