M
M
maks_petrov92021-10-16 18:19:23
Python
maks_petrov9, 2021-10-16 18:19:23

How to make the bot send a message in discord.py when the person who is tagged clicked on the reaction?

In general, I decided to do something like a "wedding", before that I wrote a test code, where the bot will write something when someone simply clicks on the reaction.
Basically, I'm self-taught and don't like to look for and use ready-made codes, but it doesn't work at all :c


The code looks very strange, so I hope you understand the idea and help)

@Bot.command()
@commands.has_permissions( administrator = True )
async def ftest(ctx, member: discor.Member):
  msg1 = await ctx.send('Testing...')
  await msg1.add_reaction(emoji = "<:Discord_on:891400544487362632>")
  await msg1.add_reaction(emoji = "<:Discord_off2:891400544730632282>")

  def check(msg):
    return(msg.id == ctx.message.id)
  event = await Bot.wait_for("reaction_add", check = check)

  while True: 	
    if event.member.reaction.emoji == "<:Discord_on:891400544487362632>":
      await ctx.send('Yes! :)')
  
    elif event.member.reaction.emoji == "<:Discord_off2:891400544730632282>":
      await ctx.send("No! :(")

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question