set_reaction()¶
- Client.set_reaction()¶
Use this method to change the chosen reactions on a message. Service messages of some types can’t be reacted to. Use
reactions_are_possibleto check if it is possible to react to the message. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can’t use paid reactions.You must use exactly one of
message_idORstory_id.If you specify,
message_idUsable by Users Bots
If you specify,
story_idUsable by Users Bots
- Parameters:¶
chat_id (``int`` | ``str``) – Unique identifier (int) or username (str) of the target chat.
message_id (``int``, *optional*) – Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
story_id (``int``, *optional*) – Identifier of the story.
reaction (List of :obj:`~pyrogram.types.ReactionType`, *optional*) – New list of reaction types to set on the message. Pass None as emoji (default) to retract the reaction. Use
add_paid_message_reaction()instead to add a paid reaction.is_big (``bool``, *optional*) – Pass True to set the reaction with a big animation. Defaults to False.
add_to_recent (``bool``, *optional*) – Pass True if the reaction should appear in the recently used reactions. This option is applicable only for users. Defaults to True.
- Returns:¶
On success, :obj:`~pyrogram.types.MessageReactions` (is returned.)
Example
# Send a reaction as a bot await app.set_reaction(chat_id, message_id, [ReactionTypeEmoji(emoji="👍")]) # Send multiple reaction as a premium user await app.set_reaction(chat_id, message_id, [ReactionTypeEmoji(emoji="👍"),ReactionTypeEmoji(emoji="😍")],True) # Retract a reaction await app.set_reaction(chat_id, message_id=message_id)