addReaction
with the message ID and the reaction emoji.
removeReaction
method.
ReactionsRequest
using ReactionsRequestBuilder
. You can specify the number of reactions to fetch with setLimit
with max limit 100. For this, you will require the ID of the message. This ID needs to be passed to the setMessageId()
method of the builder class. The set(reaction: String)
will allow you to fetch details for specific reaction or emoji.
Methods | Description |
---|---|
setMessageId(messageId: Int) | Specifies the unique identifier of the message for which you want to fetch reactions. This parameter is mandatory as it tells the SDK which message’s reactions are being requested. |
setReaction(reaction: String) | Filters the reactions fetched by the specified reaction type (e.g., ”😊”, ”😂”, ”👍”). When set, this method will cause the ReactionsRequest to only retrieve details of the provided reaction for the given message. |
fetchNext()
method fetches the next set of reactions for the message.
fetchPrevious()
method fetches the previous set of reactions for the message.
message.reactions
method. This method will return an array containing the reactions, or an empty array if no one reacted on the message.
reactedByMe()
method on any ReactionCount
object instance. This method will return a boolean value, true
if the logged-in user has reacted on that message, otherwise false
.
updateMessageWithReactionInfo()
method.
The updateMessageWithReactionInfo()
method provides a seamless way to update the reactions on a message instance (BaseMessage
) in real-time. This method ensures that when a reaction is added or removed from a message, the BaseMessage
object’s reactions
property reflects this change immediately.
When you receive a real-time reaction event (ReactionEvent
), call the updateMessageWithReactionInfo()
method, passing the BaseMessage instance (message
), reaction data from the reaction event (ReactionEvent.reaction
) and reaction event action type (ReactionAction.REACTION_ADDED
or ReactionAction.REACTION_REMOVED
) that corresponds to the message being reacted to.
message
instance’s reactions are updated. You can then use message.reactions
to get the latest reactions and refresh your UI accordingly.