Class GenericPrivateMessageReactionEvent
- java.lang.Object
-
- net.dv8tion.jda.api.events.Event
-
- net.dv8tion.jda.api.events.message.priv.GenericPrivateMessageEvent
-
- net.dv8tion.jda.api.events.message.priv.react.GenericPrivateMessageReactionEvent
-
- All Implemented Interfaces:
GenericEvent
- Direct Known Subclasses:
PrivateMessageReactionAddEvent
,PrivateMessageReactionRemoveEvent
public class GenericPrivateMessageReactionEvent extends GenericPrivateMessageEvent
Indicates that aMessageReaction
was added or removed.Can be used to detect when a message reaction is added or removed from a message.
Requirements
These events require the
DIRECT_MESSAGE_REACTIONS
intent to be enabled.
-
-
Constructor Summary
Constructors Constructor Description GenericPrivateMessageReactionEvent(JDA api, long responseNumber, MessageReaction reaction, long userId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageReaction
getReaction()
TheMessageReaction
MessageReaction.ReactionEmote
getReactionEmote()
User
getUser()
The reactingUser
This might be missing if the user was not cached.java.lang.String
getUserId()
The id for the user who added/removed their reaction.long
getUserIdLong()
The id for the user who added/removed their reaction.RestAction<Message>
retrieveMessage()
Retrieves the message for this reaction event.RestAction<User>
retrieveUser()
Retrieves theUser
who owns the reaction.-
Methods inherited from class net.dv8tion.jda.api.events.message.priv.GenericPrivateMessageEvent
getChannel, getMessageId, getMessageIdLong
-
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getResponseNumber
-
-
-
-
Constructor Detail
-
GenericPrivateMessageReactionEvent
public GenericPrivateMessageReactionEvent(@Nonnull JDA api, long responseNumber, @Nonnull MessageReaction reaction, long userId)
-
-
Method Detail
-
getUserId
@Nonnull public java.lang.String getUserId()
The id for the user who added/removed their reaction.- Returns:
- The user id
-
getUserIdLong
public long getUserIdLong()
The id for the user who added/removed their reaction.- Returns:
- The user id
-
getUser
@Nullable public User getUser()
The reactingUser
This might be missing if the user was not cached.- Returns:
- The reacting user
- See Also:
retrieveUser()
-
getReaction
@Nonnull public MessageReaction getReaction()
TheMessageReaction
- Returns:
- The message reaction
-
getReactionEmote
@Nonnull public MessageReaction.ReactionEmote getReactionEmote()
- Returns:
- The message reaction emote
-
retrieveUser
@Nonnull @CheckReturnValue public RestAction<User> retrieveUser()
- Returns:
RestAction
- Type:User
- Since:
- 4.3.1
-
retrieveMessage
@Nonnull @CheckReturnValue public RestAction<Message> retrieveMessage()
Retrieves the message for this reaction event.
Simple shortcut forgetChannel().retrieveMessageById(getMessageId())
.The
Message.getMember()
method will always return null for the resulting message.- Returns:
RestAction
- Type:Message
- Since:
- 4.3.1
-
-