Answer the question
In order to leave comments, you need to log in
How to get the number of a specific reaction on a post?
I am writing a code in which if a reaction is put on a message, then it changes, but I ran into a problem that if a new person puts it, then it also changes.
I need that if someone puts a third emotion, it will be removed, but how can I check this? I searched the forums and did not find the exact solution to the problem.
here is the code:
@bot.event
async def on_raw_reaction_add(ctx):
message = ctx.message_id
sql.execute(f"SELECT publishedid FROM tasks WHERE publishedid = '{message}'")
if sql.fetchone() != None:
if ctx.emoji.id == 807281031060258846:
achannel = bot.get_channel(ctx.channel_id)
reallymsg = await achannel.fetch_message(message)
cache_msg = discord.utils.get(bot.cached_messages, id= reallymsg.id)
testerreac = cache_msg.reactions
print(cache_msg)
print("-----------------------------------------")
print(testerreac)
print("------------------------------------------")
for i in testerreac:
print(i)
if testerreac == 807281031060258846:
print(testerreac.count)
if testreac.count > 2:
# удалить реакию
else:
# ну и дальше код который меняет сообщение
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