Package org.javacord.core.entity.message
Class MessageImpl
- java.lang.Object
-
- org.javacord.core.entity.message.MessageImpl
-
- All Implemented Interfaces:
Comparable<Message>
,DiscordEntity
,Message
,Updatable<Message>
,UpdatableFromCache<Message>
,MessageAttachableListenerManager
,InternalMessageAttachableListenerManager
public class MessageImpl extends Object implements Message, InternalMessageAttachableListenerManager
The implementation ofMessage
.
-
-
Field Summary
-
Fields inherited from interface org.javacord.api.entity.message.Message
ESCAPED_CHARACTER
-
-
Constructor Summary
Constructors Constructor Description MessageImpl(DiscordApiImpl api, TextChannel channel, com.fasterxml.jackson.databind.JsonNode data)
Creates a new message object.
-
Method Summary
-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getCreationTimestamp, getCreationTimestamp, getIdAsString
-
Methods inherited from interface org.javacord.core.listener.message.InternalMessageAttachableListenerManager
addCachedMessagePinListener, addCachedMessageUnpinListener, addMessageAttachableListener, addMessageDeleteListener, addMessageEditListener, addReactionAddListener, addReactionRemoveAllListener, addReactionRemoveListener, getCachedMessagePinListeners, getCachedMessageUnpinListeners, getMessageAttachableListeners, getMessageDeleteListeners, getMessageEditListeners, getReactionAddListeners, getReactionRemoveAllListeners, getReactionRemoveListeners, removeListener, removeMessageAttachableListener
-
Methods inherited from interface org.javacord.api.entity.message.Message
addReaction, addReaction, addReaction, addReaction, addReaction, addReaction, addReactions, canAddNewReactions, canDelete, canYouAddNewReactions, canYouDelete, delete, delete, delete, delete, delete, delete, delete, delete, delete, delete, edit, edit, edit, edit, edit, edit, edit, edit, edit, edit, edit, getCurrentCachedInstance, getGroupChannel, getLatestInstance, getMentionedChannels, getMessagesAfter, getMessagesAfterAsStream, getMessagesAfterUntil, getMessagesAfterWhile, getMessagesAround, getMessagesAroundAsStream, getMessagesAroundUntil, getMessagesAroundWhile, getMessagesBefore, getMessagesBeforeAsStream, getMessagesBeforeUntil, getMessagesBeforeWhile, getMessagesBetween, getMessagesBetween, getMessagesBetweenAsStream, getMessagesBetweenAsStream, getMessagesBetweenUntil, getMessagesBetweenUntil, getMessagesBetweenWhile, getMessagesBetweenWhile, getPrivateChannel, getReactionByEmoji, getReactionByEmoji, getReadableContent, getServer, getServerTextChannel, isGroupMessage, isPrivate, isPrivateMessage, isServerMessage, pin, pin, pin, removeAllReactions, removeAllReactions, removeAllReactions, removeContent, removeContent, removeContent, removeContentAndEmbed, removeContentAndEmbed, removeContentAndEmbed, removeEmbed, removeEmbed, removeEmbed, removeOwnReactionByEmoji, removeOwnReactionsByEmoji, removeReactionByEmoji, removeReactionByEmoji, removeReactionsByEmoji, removeReactionsByEmoji, toMessageBuilder, unpin, unpin, unpin
-
Methods inherited from interface org.javacord.api.listener.message.MessageAttachableListenerManager
addMessageAttachableListener, addMessageAttachableListener, addMessageDeleteListener, addMessageEditListener, addReactionAddListener, addReactionRemoveAllListener, addReactionRemoveListener, getMessageAttachableListeners, getMessageAttachableListeners, getMessageDeleteListeners, getMessageDeleteListeners, getMessageEditListeners, getMessageEditListeners, getReactionAddListeners, getReactionAddListeners, getReactionRemoveAllListeners, getReactionRemoveAllListeners, getReactionRemoveListeners, getReactionRemoveListeners, removeListener, removeListener, removeMessageAttachableListener, removeMessageAttachableListener
-
-
-
-
Constructor Detail
-
MessageImpl
public MessageImpl(DiscordApiImpl api, TextChannel channel, com.fasterxml.jackson.databind.JsonNode data)
Creates a new message object.- Parameters:
api
- The discord api instance.channel
- The channel of the message.data
- The json data of the message.
-
-
Method Detail
-
setContent
public void setContent(String content)
Sets the content of the message.- Parameters:
content
- The content to set.
-
setPinned
public void setPinned(boolean pinned)
Sets the pinned flag if the message.- Parameters:
pinned
- The pinned flag to set.
-
setMentionsEveryone
public void setMentionsEveryone(boolean mentionsEveryone)
Sets the mentions everyone flag.- Parameters:
mentionsEveryone
- The mentions everyone flag to set.
-
setLastEditTime
public void setLastEditTime(Instant lastEditTime)
Sets the last edit time of the message.- Parameters:
lastEditTime
- The last edit time of the message.
-
setEmbeds
public void setEmbeds(List<Embed> embeds)
Sets the embeds of the message.- Parameters:
embeds
- The embeds to set.
-
addReaction
public void addReaction(Emoji emoji, boolean you)
Adds an emoji to the list of reactions.- Parameters:
emoji
- The emoji.you
- Whether this reaction is used by you or not.
-
removeReaction
public void removeReaction(Emoji emoji, boolean you)
Removes an emoji from the list of reactions.- Parameters:
emoji
- The emoji.you
- Whether this reaction is used by you or not.
-
removeAllReactionsFromCache
public void removeAllReactionsFromCache()
Removes all reaction from this message.
-
getApi
public DiscordApi getApi()
Description copied from interface:InternalMessageAttachableListenerManager
Gets the discord api instance.- Specified by:
getApi
in interfaceDiscordEntity
- Specified by:
getApi
in interfaceInternalMessageAttachableListenerManager
- Returns:
- The discord api instance.
-
getId
public long getId()
Description copied from interface:InternalMessageAttachableListenerManager
Gets the id of this object.- Specified by:
getId
in interfaceDiscordEntity
- Specified by:
getId
in interfaceInternalMessageAttachableListenerManager
- Returns:
- The id of this object.
-
getContent
public String getContent()
- Specified by:
getContent
in interfaceMessage
-
getLastEditTimestamp
public Optional<Instant> getLastEditTimestamp()
- Specified by:
getLastEditTimestamp
in interfaceMessage
-
getAttachments
public List<MessageAttachment> getAttachments()
- Specified by:
getAttachments
in interfaceMessage
-
getCustomEmojis
public List<CustomEmoji> getCustomEmojis()
- Specified by:
getCustomEmojis
in interfaceMessage
-
getType
public MessageType getType()
-
getChannel
public TextChannel getChannel()
- Specified by:
getChannel
in interfaceMessage
-
getActivity
public Optional<MessageActivity> getActivity()
- Specified by:
getActivity
in interfaceMessage
-
mentionsEveryone
public boolean mentionsEveryone()
- Specified by:
mentionsEveryone
in interfaceMessage
-
getAuthor
public MessageAuthor getAuthor()
-
getUserAuthor
public Optional<User> getUserAuthor()
- Specified by:
getUserAuthor
in interfaceMessage
-
isCachedForever
public boolean isCachedForever()
- Specified by:
isCachedForever
in interfaceMessage
-
setCachedForever
public void setCachedForever(boolean cachedForever)
- Specified by:
setCachedForever
in interfaceMessage
-
getReactions
public List<Reaction> getReactions()
- Specified by:
getReactions
in interfaceMessage
-
getMentionedUsers
public List<User> getMentionedUsers()
- Specified by:
getMentionedUsers
in interfaceMessage
-
getMentionedRoles
public List<Role> getMentionedRoles()
- Specified by:
getMentionedRoles
in interfaceMessage
-
addReactions
public CompletableFuture<Void> addReactions(String... unicodeEmojis)
- Specified by:
addReactions
in interfaceMessage
-
removeReactionByEmoji
public CompletableFuture<Void> removeReactionByEmoji(User user, String unicodeEmoji)
- Specified by:
removeReactionByEmoji
in interfaceMessage
-
removeReactionByEmoji
public CompletableFuture<Void> removeReactionByEmoji(String unicodeEmoji)
- Specified by:
removeReactionByEmoji
in interfaceMessage
-
removeReactionsByEmoji
public CompletableFuture<Void> removeReactionsByEmoji(User user, String... unicodeEmojis)
- Specified by:
removeReactionsByEmoji
in interfaceMessage
-
removeReactionsByEmoji
public CompletableFuture<Void> removeReactionsByEmoji(String... unicodeEmojis)
- Specified by:
removeReactionsByEmoji
in interfaceMessage
-
removeOwnReactionByEmoji
public CompletableFuture<Void> removeOwnReactionByEmoji(String unicodeEmoji)
- Specified by:
removeOwnReactionByEmoji
in interfaceMessage
-
removeOwnReactionsByEmoji
public CompletableFuture<Void> removeOwnReactionsByEmoji(String... unicodeEmojis)
- Specified by:
removeOwnReactionsByEmoji
in interfaceMessage
-
compareTo
public int compareTo(Message otherMessage)
- Specified by:
compareTo
in interfaceComparable<Message>
-
-