Answer the question
In order to leave comments, you need to log in
How to count the number of reactions on a post in Discord?
Hello, I'm making a poll function for my bot, and I want it to sum up after a certain time. The polling function itself is implemented through reactions (one reaction for each option). To summarize, I need the bot to count the number of each reaction. How can this be implemented?
My code:
@bot.command(name='poll')
async def poll(ctx, question, option1 = None, option2 = None):
if option1 == None and option2 == None:
embed = discord.Embed(
title="Poll",
description=f"{question}",
color = discord.Color.blue()
)
msg = await ctx.channel.send(embed=embed)
message = await ctx.channel.fetch_message(msg.id)
await message.add_reaction("")
await message.add_reaction("")
embed = discord.Embed(
title="Poll",
description=f"{question}",
color=discord.Color.blue()
)
embed.add_field(name=f"{option1}", inline=False)
embed.add_field(name=f"{option2}", inline=False)
msg = await ctx.channel.send(embed=embed)
message = await ctx.channel.fetch_message(msg.id)
await message.add_reaction("")
await message.add_reaction("")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question