Answer the question
In order to leave comments, you need to log in
How to make the bot react when they put a reaction on a message?
I need the bot to respond to a given reaction to a message in a channel by pinging a specific role in another. Important: my bot is configured to set reactions to all new messages in a certain channel, and now it should react to the set reactions in the messages of this channel, but it is desirable that only 1 clicked, i.e. the one who clicked 1. Don't ask why I do this.
Answer the question
In order to leave comments, you need to log in
If you need to perform an action on a specific reaction, then you can do as below, but keep in mind that this is a method for cogs, if you do not have cogs, then redo it for yourself:
@commands.command()
async def command_name(self, ctx):
channel = self.bot.get_channel(channel_id) # берем id чата
message = await channel.fetch_message(message_id) #получаем все о сообщении по его id
resactions = [reaction for reaction in message.reactions if reaction.emoji in ['иконка реакции1', 'иконка реакции2', 'иконка реакции3']]
for reaction in resactions:
if reaction.emoji == 'иконка реакции1':
print("нажата реакция 'город'")
elif reaction.emoji == 'иконка реакции2':
# do your task...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question