public class MessageReaction
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
MessageReaction.ReactionEmote |
Represents an Emoji/Emote of a MessageReaction
This is used to wrap both emojis and emotes |
Constructor | Description |
---|---|
MessageReaction(MessageChannel channel,
MessageReaction.ReactionEmote emote,
long messageId,
boolean self,
int count) |
Creates a new MessageReaction instance
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object obj) |
|
MessageChannel |
getChannel() |
The
MessageChannel
this Reaction was used in. |
ChannelType |
getChannelType() |
The
ChannelType
this Reaction was used in. |
int |
getCount() |
The amount of users that already reacted with this Reaction
This is not updated, it is a final int per Reaction instance |
Group |
getGroup() |
|
Guild |
getGuild() |
|
JDA |
getJDA() |
The JDA instance of this Reaction
|
java.lang.String |
getMessageId() |
The message id this reaction is attached to
|
long |
getMessageIdLong() |
The message id this reaction is attached to
|
PrivateChannel |
getPrivateChannel() |
|
MessageReaction.ReactionEmote |
getReactionEmote() |
The
ReactionEmote
of this Reaction |
TextChannel |
getTextChannel() |
|
ReactionPaginationAction |
getUsers() |
Retrieves the
Users that
already reacted with this MessageReaction. |
ReactionPaginationAction |
getUsers(int amount) |
Retrieves the
Users that
already reacted with this MessageReaction. |
boolean |
isFromType(ChannelType type) |
Whether this Reaction was used in a
MessageChannel
of the specified ChannelType . |
boolean |
isSelf() |
Whether the currently logged in account has reacted with this reaction
|
RestAction<java.lang.Void> |
removeReaction() |
Removes this Reaction from the Message.
|
RestAction<java.lang.Void> |
removeReaction(User user) |
Removes this Reaction from the Message.
|
java.lang.String |
toString() |
public MessageReaction(MessageChannel channel, MessageReaction.ReactionEmote emote, long messageId, boolean self, int count)
channel
- The MessageChannel
this Reaction was used inemote
- The ReactionEmote
that was usedmessageId
- The message id this reaction is attached toself
- Whether we already reacted with this Reactioncount
- The amount of people that reacted with this Reactionpublic JDA getJDA()
public boolean isSelf()
public int getCount()
final int
per Reaction instance
This value is not available in events such as MessageReactionAddEvent
and MessageReactionRemoveEvent
in which case an
IllegalStateException
is thrown!
java.lang.IllegalStateException
- If this MessageReaction is from an event which does not provide a countpublic ChannelType getChannelType()
ChannelType
this Reaction was used in.public boolean isFromType(ChannelType type)
MessageChannel
of the specified ChannelType
.type
- The ChannelType to comparepublic Guild getGuild()
Guild
this Reaction was used in,
this might return null
when this Reaction was not used in a MessageChannel
from the ChannelType TEXT
!Guild
this Reaction was used in, or null
public TextChannel getTextChannel()
TextChannel
or null
public PrivateChannel getPrivateChannel()
PrivateChannel
or null
public MessageChannel getChannel()
MessageChannel
this Reaction was used in.public MessageReaction.ReactionEmote getReactionEmote()
ReactionEmote
of this Reactionpublic java.lang.String getMessageId()
public long getMessageIdLong()
@CheckReturnValue public ReactionPaginationAction getUsers()
Users
that
already reacted with this MessageReaction.
getUsers(int)
with 100
.
Possible ErrorResponses include:
UNKNOWN_MESSAGE
UNKNOWN_CHANNEL
MISSING_ACCESS
ReactionPaginationAction
@CheckReturnValue public ReactionPaginationAction getUsers(int amount)
Users
that
already reacted with this MessageReaction. The maximum amount of users
that can be retrieved is 100.
Possible ErrorResponses include:
UNKNOWN_MESSAGE
UNKNOWN_CHANNEL
MISSING_ACCESS
amount
- the amount of users to retrieveReactionPaginationAction
java.lang.IllegalArgumentException
- if the provided amount is not between 1-100@CheckReturnValue public RestAction<java.lang.Void> removeReaction()
removeReaction(User)
.
Possible ErrorResponses include:
UNKNOWN_MESSAGE
UNKNOWN_CHANNEL
MISSING_ACCESS
RestAction
- Type: Void
Nothing is returned on success@CheckReturnValue public RestAction<java.lang.Void> removeReaction(User user)
User
provided.
If the provided User did not react with this Reaction this does nothing.
Possible ErrorResponses include:
UNKNOWN_MESSAGE
UNKNOWN_CHANNEL
MISSING_ACCESS
user
- The User of which to remove the reactionRestAction
- Type: Void
Nothing is returned on successjava.lang.IllegalArgumentException
- If the provided user
is null.InsufficientPermissionException
- if the provided User is not us and we do not have permission to
manage messages
in the channel this reaction was used inpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object