F
F
frykktik2022-01-14 19:54:40
Python
frykktik, 2022-01-14 19:54:40

The bot should send a message to the chat when someone clicked on an emoji, how to do it?

I have been tormenting for an hour over the bot, it is necessary that when someone clicks on an emoji, it sends a message about this to a separate channel. Below is the code and it doesn't work.

here is my code:

@bot.event
async def on_reaction_add(reaction, user):
    Channel = bot.get_channel(930870896107860031)
    if reaction.message.channel.id == Channel:
      if reaction.emoji == "\U0001F4B5":
          my_channel = bot.get_channel(931423249210966056)
          await my_channel.send("аааа")

Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2022-01-14
@frykktik

on_reaction_addcalled only when a message was sent while the bot was running (roughly)
https://discordpy.readthedocs.io/en/async/api.html...
Better use on_raw_reaction_add
https://discordpy.readthedocs.io/en/latest/ api.htm...
In the case of a on_raw_reaction_add(payload)channel id, it is in payload.channel_id
Well, and such a condition is unlikely to work, you are trying to compare an object of the Channel class with a number. If you compare id - then compare ID, you do not need to get a channel in this case

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question