Interface Message
-
- All Superinterfaces:
java.lang.Comparable<Message>,DiscordEntity,MessageAttachableListenerManager,Updatable<Message>,UpdatableFromCache<Message>
public interface Message extends DiscordEntity, java.lang.Comparable<Message>, UpdatableFromCache<Message>, MessageAttachableListenerManager
This class represents a Discord message.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.concurrent.CompletableFuture<java.lang.Void>addReaction(java.lang.String unicodeEmoji)Adds a unicode reaction to the message.static java.util.concurrent.CompletableFuture<java.lang.Void>addReaction(DiscordApi api, long channelId, long messageId, java.lang.String unicodeEmoji)Adds a unicode reaction to the message.static java.util.concurrent.CompletableFuture<java.lang.Void>addReaction(DiscordApi api, long channelId, long messageId, Emoji emoji)Adds a reaction to the message.static java.util.concurrent.CompletableFuture<java.lang.Void>addReaction(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String unicodeEmoji)Adds a unicode reaction to the message.static java.util.concurrent.CompletableFuture<java.lang.Void>addReaction(DiscordApi api, java.lang.String channelId, java.lang.String messageId, Emoji emoji)Adds a reaction to the message.default java.util.concurrent.CompletableFuture<java.lang.Void>addReaction(Emoji emoji)Adds a reaction to the message.java.util.concurrent.CompletableFuture<java.lang.Void>addReactions(java.lang.String... unicodeEmojis)Adds unicode reactions to the message.default java.util.concurrent.CompletableFuture<java.lang.Void>addReactions(Emoji... emojis)Adds reactions to the message.default booleancanAddNewReactions(User user)Checks if the given user is allowed to add new reactions to the message.default booleancanDelete(User user)Checks if the given user can delete this message.default booleancanYouAddNewReactions()Checks if the user of the connected account is allowed to add new reactions to the message.default booleancanYouDelete()Checks if the user of the connected account can delete this message.default java.util.concurrent.CompletableFuture<ServerThreadChannel>createThread(java.lang.String name, java.lang.Integer autoArchiveDuration)Creates a thread for this message.default java.util.concurrent.CompletableFuture<ServerThreadChannel>createThread(java.lang.String name, AutoArchiveDuration autoArchiveDuration)Creates a thread for this message.default MessageUpdatercreateUpdater()Creates a newMessageUpdaterfor this message that can be used similarly to a builder to edit this message.default java.util.concurrent.CompletableFuture<Message>crossPost()Cross posts the message if it is in an announcement channel.static java.util.concurrent.CompletableFuture<Message>crossPost(DiscordApi api, long channelId, long messageId)Cross posts the message if it is in an announcement channel.default java.util.concurrent.CompletableFuture<java.lang.Void>delete()Deletes the message.default java.util.concurrent.CompletableFuture<java.lang.Void>delete(java.lang.String reason)Deletes the message.static java.util.concurrent.CompletableFuture<java.lang.Void>delete(DiscordApi api, long channelId, long messageId)Deletes the message.static java.util.concurrent.CompletableFuture<java.lang.Void>delete(DiscordApi api, long channelId, long... messageIds)Deletes multiple messages at once.static java.util.concurrent.CompletableFuture<java.lang.Void>delete(DiscordApi api, long channelId, long messageId, java.lang.String reason)Deletes the message.static java.util.concurrent.CompletableFuture<java.lang.Void>delete(DiscordApi api, java.lang.Iterable<Message> messages)Deletes multiple messages at once.static java.util.concurrent.CompletableFuture<java.lang.Void>delete(DiscordApi api, java.lang.String channelId, java.lang.String messageId)Deletes the message.static java.util.concurrent.CompletableFuture<java.lang.Void>delete(DiscordApi api, java.lang.String channelId, java.lang.String... messageIds)Deletes multiple messages at once.static java.util.concurrent.CompletableFuture<java.lang.Void>delete(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String reason)Deletes the message.static java.util.concurrent.CompletableFuture<java.lang.Void>delete(DiscordApi api, Message... messages)Deletes multiple messages at once.default java.util.concurrent.CompletableFuture<Message>edit(java.lang.String content)Updates the content of the message.default java.util.concurrent.CompletableFuture<Message>edit(java.lang.String content, java.util.List<EmbedBuilder> embeds)Updates the content and the embed of the message.default java.util.concurrent.CompletableFuture<Message>edit(java.lang.String content, EmbedBuilder... embeds)Updates the content and the embed of the message.default java.util.concurrent.CompletableFuture<Message>edit(java.util.List<EmbedBuilder> embeds)Updates the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, long channelId, long messageId, java.lang.String content)Updates the content of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, long channelId, long messageId, java.lang.String content, boolean updateContent, java.util.List<EmbedBuilder> embeds, boolean updateEmbed)Updates the content and the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, long channelId, long messageId, java.lang.String content, java.util.List<EmbedBuilder> embeds)Updates the content and the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, long channelId, long messageId, java.lang.String content, EmbedBuilder... embeds)Updates the content and the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, long channelId, long messageId, java.util.List<EmbedBuilder> embeds)Updates the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, long channelId, long messageId, EmbedBuilder... embeds)Updates the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String content)Updates the content of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String content, boolean updateContent, java.util.List<EmbedBuilder> embeds, boolean updateEmbed)Updates the content and the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String content, java.util.List<EmbedBuilder> embeds)Updates the content and the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String content, EmbedBuilder... embeds)Updates the content and the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.util.List<EmbedBuilder> embeds)Updates the embed of the message.static java.util.concurrent.CompletableFuture<Message>edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, EmbedBuilder... embeds)Updates the embed of the message.default java.util.concurrent.CompletableFuture<Message>edit(EmbedBuilder... embeds)Updates the embed of the message.java.util.Optional<MessageActivity>getActivity()Gets the activity of the message.java.util.List<MessageAttachment>getAttachments()Gets the attachments of the message.MessageAuthorgetAuthor()Gets the author of the message.TextChannelgetChannel()Gets the text channel of the message.java.util.List<HighLevelComponent>getComponents()Gets a list with all components of the message.java.lang.StringgetContent()Gets the content of the message.default java.util.Optional<Message>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.java.util.List<CustomEmoji>getCustomEmojis()Gets a list of all custom emojis in the message.java.util.List<Embed>getEmbeds()Gets a list with all embeds of the message.java.util.Optional<java.time.Instant>getLastEditTimestamp()Gets the last time the message was edited.default java.util.concurrent.CompletableFuture<Message>getLatestInstance()Gets an updated instance of this entity from the cache or from Discord directly.default java.net.URLgetLink()Gets the link leading to this message.default java.util.List<ServerChannel>getMentionedChannels()Gets a list with all channels mentioned in this message.java.util.List<Role>getMentionedRoles()Gets a list with all roles mentioned in this message.java.util.List<User>getMentionedUsers()Gets a list with all users mentioned in this message.java.util.Optional<MessageReference>getMessageReference()Gets the message reference of the message.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesAfter(int limit)Gets up to a given amount of messages after this message.default java.util.stream.Stream<Message>getMessagesAfterAsStream()Gets a stream of messages after this message sorted from oldest to newest.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesAfterUntil(java.util.function.Predicate<Message> condition)Gets messages after this message until one that meets the given condition is found.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesAfterWhile(java.util.function.Predicate<Message> condition)Gets messages after this message while they meet the given condition.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesAround(int limit)Gets up to a given amount of messages around this message.default java.util.stream.Stream<Message>getMessagesAroundAsStream()Gets a stream of messages around this message.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesAroundUntil(java.util.function.Predicate<Message> condition)Gets messages around this message until one that meets the given condition is found.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesAroundWhile(java.util.function.Predicate<Message> condition)Gets messages around this message while they meet the given condition.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBefore(int limit)Gets up to a given amount of messages before this message.default java.util.stream.Stream<Message>getMessagesBeforeAsStream()Gets a stream of messages before this message sorted from newest to oldest.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBeforeUntil(java.util.function.Predicate<Message> condition)Gets messages before this message until one that meets the given condition is found.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBeforeWhile(java.util.function.Predicate<Message> condition)Gets messages before this message while they meet the given condition.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBetween(long other)Gets all messages between this message and the given message, excluding the boundaries.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBetween(Message other)Gets all messages between this message and the given message, excluding the boundaries.default java.util.stream.Stream<Message>getMessagesBetweenAsStream(long other)Gets a stream of all messages between this message and the given message, excluding the boundaries, sorted from this message to the given message.default java.util.stream.Stream<Message>getMessagesBetweenAsStream(Message other)Gets a stream of all messages between this message and the given message, excluding the boundaries, sorted from this message to the given message.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBetweenUntil(long other, java.util.function.Predicate<Message> condition)Gets all messages between this message and the given message, excluding the boundaries, until one that meets the given condition is found.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBetweenUntil(Message other, java.util.function.Predicate<Message> condition)Gets all messages between this message and the given message, excluding the boundaries, until one that meets the given condition is found.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBetweenWhile(long other, java.util.function.Predicate<Message> condition)Gets all messages between this message and the given message, excluding the boundaries, while they meet the given condition.default java.util.concurrent.CompletableFuture<MessageSet>getMessagesBetweenWhile(Message other, java.util.function.Predicate<Message> condition)Gets all messages between this message and the given message, excluding the boundaries, while they meet the given condition.java.util.Optional<java.lang.String>getNonce()Gets the nonce of the message.default java.util.Optional<PrivateChannel>getPrivateChannel()Gets the private channel of the message.default java.util.Optional<Reaction>getReactionByEmoji(java.lang.String unicodeEmoji)Gets a reaction by its unicode emoji.default java.util.Optional<Reaction>getReactionByEmoji(Emoji emoji)Gets a reaction by its emoji.java.util.List<Reaction>getReactions()Gets a list with all reactions of the message.default java.lang.StringgetReadableContent()Gets the readable content of the message, which replaces all mentions etc.java.util.Optional<Message>getReferencedMessage()Gets the message referenced with a reply.default java.util.Optional<Server>getServer()Gets the server of the message.default java.util.Optional<ServerTextChannel>getServerTextChannel()Gets the server text channel of the message.default java.util.Optional<ServerThreadChannel>getServerThreadChannel()Gets the server thread channel of the message.java.util.Set<StickerItem>getStickerItems()Gets the sticker items of the message.MessageTypegetType()Gets the type of the message.java.util.Optional<User>getUserAuthor()Gets the user author of the message.booleanisCachedForever()Checks if the message is kept in cache forever.booleanisPinned()Checks if the message is pinned.default booleanisPrivateMessage()Checks if the message was sent in aprivate channel.default booleanisServerMessage()Checks if the message was sent in aserver channel.booleanisTts()Checks if this message is text-to-speech.booleanmentionsEveryone()Checks if the message mentions everyone.default java.util.concurrent.CompletableFuture<java.lang.Void>pin()Pins this message.static java.util.concurrent.CompletableFuture<java.lang.Void>pin(DiscordApi api, long channelId, long messageId)Pins this message.static java.util.concurrent.CompletableFuture<java.lang.Void>pin(DiscordApi api, java.lang.String channelId, java.lang.String messageId)Pins this message.default java.util.concurrent.CompletableFuture<java.lang.Void>removeAllReactions()Deletes all reactions on this message.static java.util.concurrent.CompletableFuture<java.lang.Void>removeAllReactions(DiscordApi api, long channelId, long messageId)Deletes all reactions on this message.static java.util.concurrent.CompletableFuture<java.lang.Void>removeAllReactions(DiscordApi api, java.lang.String channelId, java.lang.String messageId)Deletes all reactions on this message.default java.util.concurrent.CompletableFuture<Message>removeContent()Removes the content of the message.static java.util.concurrent.CompletableFuture<Message>removeContent(DiscordApi api, long channelId, long messageId)Removes the content of the message.static java.util.concurrent.CompletableFuture<Message>removeContent(DiscordApi api, java.lang.String channelId, java.lang.String messageId)Removes the content of the message.default java.util.concurrent.CompletableFuture<Message>removeContentAndEmbed()Removes the content and embed of the message.static java.util.concurrent.CompletableFuture<Message>removeContentAndEmbed(DiscordApi api, long channelId, long messageId)Removes the content and embed of the message.static java.util.concurrent.CompletableFuture<Message>removeContentAndEmbed(DiscordApi api, java.lang.String channelId, java.lang.String messageId)Removes the content and embed of the message.default java.util.concurrent.CompletableFuture<Message>removeEmbed()Removes the embed of the message.static java.util.concurrent.CompletableFuture<Message>removeEmbed(DiscordApi api, long channelId, long messageId)Removes the embed of the message.static java.util.concurrent.CompletableFuture<Message>removeEmbed(DiscordApi api, java.lang.String channelId, java.lang.String messageId)Removes the embed of the message.java.util.concurrent.CompletableFuture<java.lang.Void>removeOwnReactionByEmoji(java.lang.String unicodeEmoji)Removes you from the list of reactors of a given unicode emoji reaction.default java.util.concurrent.CompletableFuture<java.lang.Void>removeOwnReactionByEmoji(Emoji emoji)Removes you from the list of reactors of a given emoji reaction.java.util.concurrent.CompletableFuture<java.lang.Void>removeOwnReactionsByEmoji(java.lang.String... unicodeEmojis)Removes you from the list of reactors of the given unicode emoji reactions.default java.util.concurrent.CompletableFuture<java.lang.Void>removeOwnReactionsByEmoji(Emoji... emojis)Removes you from the list of reactors of the given emoji reactions.java.util.concurrent.CompletableFuture<java.lang.Void>removeReactionByEmoji(java.lang.String unicodeEmoji)Removes all reactors of a given unicode emoji reaction.default java.util.concurrent.CompletableFuture<java.lang.Void>removeReactionByEmoji(Emoji emoji)Removes all reactors of a given emoji reaction.java.util.concurrent.CompletableFuture<java.lang.Void>removeReactionByEmoji(User user, java.lang.String unicodeEmoji)Removes a user from the list of reactors of a given unicode emoji reaction.default java.util.concurrent.CompletableFuture<java.lang.Void>removeReactionByEmoji(User user, Emoji emoji)Removes a user from the list of reactors of a given emoji reaction.java.util.concurrent.CompletableFuture<java.lang.Void>removeReactionsByEmoji(java.lang.String... unicodeEmojis)Removes all reactors of the given unicode emoji reactions.default java.util.concurrent.CompletableFuture<java.lang.Void>removeReactionsByEmoji(Emoji... emojis)Removes all reactors of the given emoji reactions.java.util.concurrent.CompletableFuture<java.lang.Void>removeReactionsByEmoji(User user, java.lang.String... unicodeEmojis)Removes a user from the list of reactors of the given unicode emoji reactions.default java.util.concurrent.CompletableFuture<java.lang.Void>removeReactionsByEmoji(User user, Emoji... emojis)Removes a user from the list of reactors of the given emoji reactions.default java.util.concurrent.CompletableFuture<Message>reply(java.lang.String messageContent)Replies to this message with the given text.default java.util.concurrent.CompletableFuture<Message>reply(EmbedBuilder embed)Replies to this message with the given embed.default java.util.Optional<java.util.concurrent.CompletableFuture<Message>>requestReferencedMessage()Requests the message referenced with a reply.voidsetCachedForever(boolean cachedForever)Sets if the message is kept in cache forever.default MessageBuildertoMessageBuilder()Returns aMessageBuilderaccording to thisMessage.default WebhookMessageBuildertoWebhookMessageBuilder()Returns aWebhookMessageBuilderaccording to thisMessage.default java.util.concurrent.CompletableFuture<java.lang.Void>unpin()Unpins this message.static java.util.concurrent.CompletableFuture<java.lang.Void>unpin(DiscordApi api, long channelId, long messageId)Unpins this message.static java.util.concurrent.CompletableFuture<java.lang.Void>unpin(DiscordApi api, java.lang.String channelId, java.lang.String messageId)Unpins this message.-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getApi, getCreationTimestamp, getId, getIdAsString
-
Methods inherited from interface org.javacord.api.listener.message.MessageAttachableListenerManager
addButtonClickListener, addCachedMessagePinListener, addCachedMessageUnpinListener, addMessageAttachableListener, addMessageComponentCreateListener, addMessageContextMenuCommandListener, addMessageDeleteListener, addMessageEditListener, addReactionAddListener, addReactionRemoveAllListener, addReactionRemoveListener, addSelectMenuChooseListener, getButtonClickListeners, getCachedMessagePinListeners, getCachedMessageUnpinListeners, getMessageAttachableListeners, getMessageComponentCreateListeners, getMessageContextMenuCommandListeners, getMessageDeleteListeners, getMessageEditListeners, getReactionAddListeners, getReactionRemoveAllListeners, getReactionRemoveListeners, getSelectMenuChooseListeners, removeListener, removeMessageAttachableListener
-
-
-
-
Method Detail
-
toMessageBuilder
default MessageBuilder toMessageBuilder()
Returns aMessageBuilderaccording to thisMessage.- Returns:
- The
MessageBuilder. - See Also:
MessageBuilder.fromMessage(Message)
-
toWebhookMessageBuilder
default WebhookMessageBuilder toWebhookMessageBuilder()
Returns aWebhookMessageBuilderaccording to thisMessage.- Returns:
- The
WebhookMessageBuilder. - See Also:
WebhookMessageBuilder.fromMessage(Message)
-
crossPost
static java.util.concurrent.CompletableFuture<Message> crossPost(DiscordApi api, long channelId, long messageId)
Cross posts the message if it is in an announcement channel.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- The new message object.
-
crossPost
default java.util.concurrent.CompletableFuture<Message> crossPost()
Cross posts the message if it is in an announcement channel.- Returns:
- The new message object.
-
delete
static java.util.concurrent.CompletableFuture<java.lang.Void> delete(DiscordApi api, long channelId, long messageId)
Deletes the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to tell us if the deletion was successful.
-
delete
static java.util.concurrent.CompletableFuture<java.lang.Void> delete(DiscordApi api, java.lang.String channelId, java.lang.String messageId)
Deletes the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to tell us if the deletion was successful.
-
delete
static java.util.concurrent.CompletableFuture<java.lang.Void> delete(DiscordApi api, long channelId, long messageId, java.lang.String reason)
Deletes the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.reason- The audit log reason for the deletion.- Returns:
- A future to tell us if the deletion was successful.
-
delete
static java.util.concurrent.CompletableFuture<java.lang.Void> delete(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String reason)
Deletes the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.reason- The audit log reason for the deletion.- Returns:
- A future to tell us if the deletion was successful.
-
delete
default java.util.concurrent.CompletableFuture<java.lang.Void> delete()
Deletes the message.- Returns:
- A future to tell us if the deletion was successful.
-
delete
default java.util.concurrent.CompletableFuture<java.lang.Void> delete(java.lang.String reason)
Deletes the message.- Parameters:
reason- The audit log reason for the deletion.- Returns:
- A future to tell us if the deletion was successful.
-
delete
static java.util.concurrent.CompletableFuture<java.lang.Void> delete(DiscordApi api, long channelId, long... messageIds)
Deletes multiple messages at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageIds- The ids of the messages to delete.- Returns:
- A future to tell us if the deletion was successful.
-
delete
static java.util.concurrent.CompletableFuture<java.lang.Void> delete(DiscordApi api, java.lang.String channelId, java.lang.String... messageIds)
Deletes multiple messages at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageIds- The ids of the messages to delete.- Returns:
- A future to tell us if the deletion was successful.
-
delete
static java.util.concurrent.CompletableFuture<java.lang.Void> delete(DiscordApi api, Message... messages)
Deletes multiple messages at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.- Parameters:
api- The discord api instance.messages- The messages to delete.- Returns:
- A future to tell us if the deletion was successful.
-
delete
static java.util.concurrent.CompletableFuture<java.lang.Void> delete(DiscordApi api, java.lang.Iterable<Message> messages)
Deletes multiple messages at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.- Parameters:
api- The discord api instance.messages- The messages to delete.- Returns:
- A future to tell us if the deletion was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, long channelId, long messageId, java.lang.String content)
Updates the content of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.content- The new content of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String content)
Updates the content of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.content- The new content of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, long channelId, long messageId, EmbedBuilder... embeds)
Updates the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, long channelId, long messageId, java.util.List<EmbedBuilder> embeds)
Updates the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, EmbedBuilder... embeds)
Updates the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.util.List<EmbedBuilder> embeds)
Updates the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, long channelId, long messageId, java.lang.String content, EmbedBuilder... embeds)
Updates the content and the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.content- The new content of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, long channelId, long messageId, java.lang.String content, java.util.List<EmbedBuilder> embeds)
Updates the content and the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.content- The new content of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String content, EmbedBuilder... embeds)
Updates the content and the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.content- The new content of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String content, java.util.List<EmbedBuilder> embeds)
Updates the content and the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.content- The new content of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, long channelId, long messageId, java.lang.String content, boolean updateContent, java.util.List<EmbedBuilder> embeds, boolean updateEmbed)
Updates the content and the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.content- The new content of the message.updateContent- Whether to update or remove the content.embeds- An array of the new embeds of the message.updateEmbed- Whether to update or remove the embed.- Returns:
- A future to check if the update was successful.
-
edit
static java.util.concurrent.CompletableFuture<Message> edit(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String content, boolean updateContent, java.util.List<EmbedBuilder> embeds, boolean updateEmbed)
Updates the content and the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.content- The new content of the message.updateContent- Whether to update or remove the content.embeds- An array of the new embeds of the message.updateEmbed- Whether to update or remove the embed.- Returns:
- A future to check if the update was successful.
-
edit
default java.util.concurrent.CompletableFuture<Message> edit(java.lang.String content)
Updates the content of the message.- Parameters:
content- The new content of the message.- Returns:
- A future to check if the update was successful.
-
edit
default java.util.concurrent.CompletableFuture<Message> edit(EmbedBuilder... embeds)
Updates the embed of the message.- Parameters:
embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
default java.util.concurrent.CompletableFuture<Message> edit(java.util.List<EmbedBuilder> embeds)
Updates the embed of the message.- Parameters:
embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
default java.util.concurrent.CompletableFuture<Message> edit(java.lang.String content, EmbedBuilder... embeds)
Updates the content and the embed of the message.- Parameters:
content- The new content of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
edit
default java.util.concurrent.CompletableFuture<Message> edit(java.lang.String content, java.util.List<EmbedBuilder> embeds)
Updates the content and the embed of the message.- Parameters:
content- The new content of the message.embeds- An array of the new embeds of the message.- Returns:
- A future to check if the update was successful.
-
createUpdater
default MessageUpdater createUpdater()
Creates a newMessageUpdaterfor this message that can be used similarly to a builder to edit this message.- Returns:
- the new message updater
-
removeContent
static java.util.concurrent.CompletableFuture<Message> removeContent(DiscordApi api, long channelId, long messageId)
Removes the content of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to check if the removal was successful.
-
removeContent
static java.util.concurrent.CompletableFuture<Message> removeContent(DiscordApi api, java.lang.String channelId, java.lang.String messageId)
Removes the content of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to check if the removal was successful.
-
removeContent
default java.util.concurrent.CompletableFuture<Message> removeContent()
Removes the content of the message.- Returns:
- A future to check if the removal was successful.
-
removeEmbed
static java.util.concurrent.CompletableFuture<Message> removeEmbed(DiscordApi api, long channelId, long messageId)
Removes the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to check if the removal was successful.
-
removeEmbed
static java.util.concurrent.CompletableFuture<Message> removeEmbed(DiscordApi api, java.lang.String channelId, java.lang.String messageId)
Removes the embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to check if the removal was successful.
-
removeEmbed
default java.util.concurrent.CompletableFuture<Message> removeEmbed()
Removes the embed of the message.- Returns:
- A future to check if the removal was successful.
-
removeContentAndEmbed
static java.util.concurrent.CompletableFuture<Message> removeContentAndEmbed(DiscordApi api, long channelId, long messageId)
Removes the content and embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to check if the removal was successful.
-
removeContentAndEmbed
static java.util.concurrent.CompletableFuture<Message> removeContentAndEmbed(DiscordApi api, java.lang.String channelId, java.lang.String messageId)
Removes the content and embed of the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to check if the removal was successful.
-
removeContentAndEmbed
default java.util.concurrent.CompletableFuture<Message> removeContentAndEmbed()
Removes the content and embed of the message.- Returns:
- A future to check if the removal was successful.
-
addReaction
static java.util.concurrent.CompletableFuture<java.lang.Void> addReaction(DiscordApi api, long channelId, long messageId, java.lang.String unicodeEmoji)
Adds a unicode reaction to the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.unicodeEmoji- The unicode emoji string.- Returns:
- A future to tell us if the action was successful.
-
addReaction
static java.util.concurrent.CompletableFuture<java.lang.Void> addReaction(DiscordApi api, java.lang.String channelId, java.lang.String messageId, java.lang.String unicodeEmoji)
Adds a unicode reaction to the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.unicodeEmoji- The unicode emoji string.- Returns:
- A future to tell us if the action was successful.
-
addReaction
default java.util.concurrent.CompletableFuture<java.lang.Void> addReaction(Emoji emoji)
Adds a reaction to the message.- Parameters:
emoji- The emoji.- Returns:
- A future to tell us if the action was successful.
-
addReaction
static java.util.concurrent.CompletableFuture<java.lang.Void> addReaction(DiscordApi api, long channelId, long messageId, Emoji emoji)
Adds a reaction to the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.emoji- The emoji.- Returns:
- A future to tell us if the action was successful.
-
addReaction
default java.util.concurrent.CompletableFuture<java.lang.Void> addReaction(java.lang.String unicodeEmoji)
Adds a unicode reaction to the message.- Parameters:
unicodeEmoji- The unicode emoji string.- Returns:
- A future to tell us if the action was successful.
-
addReaction
static java.util.concurrent.CompletableFuture<java.lang.Void> addReaction(DiscordApi api, java.lang.String channelId, java.lang.String messageId, Emoji emoji)
Adds a reaction to the message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.emoji- The emoji.- Returns:
- A future to tell us if the action was successful.
-
removeAllReactions
static java.util.concurrent.CompletableFuture<java.lang.Void> removeAllReactions(DiscordApi api, long channelId, long messageId)
Deletes all reactions on this message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to tell us if the deletion was successful.
-
removeAllReactions
static java.util.concurrent.CompletableFuture<java.lang.Void> removeAllReactions(DiscordApi api, java.lang.String channelId, java.lang.String messageId)
Deletes all reactions on this message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to tell us if the deletion was successful.
-
removeAllReactions
default java.util.concurrent.CompletableFuture<java.lang.Void> removeAllReactions()
Deletes all reactions on this message.- Returns:
- A future to tell us if the deletion was successful.
-
pin
static java.util.concurrent.CompletableFuture<java.lang.Void> pin(DiscordApi api, long channelId, long messageId)
Pins this message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to tell us if the pin was successful.
-
pin
static java.util.concurrent.CompletableFuture<java.lang.Void> pin(DiscordApi api, java.lang.String channelId, java.lang.String messageId)
Pins this message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to tell us if the pin was successful.
-
pin
default java.util.concurrent.CompletableFuture<java.lang.Void> pin()
Pins this message.- Returns:
- A future to tell us if the pin was successful.
-
unpin
static java.util.concurrent.CompletableFuture<java.lang.Void> unpin(DiscordApi api, long channelId, long messageId)
Unpins this message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to tell us if the action was successful.
-
unpin
static java.util.concurrent.CompletableFuture<java.lang.Void> unpin(DiscordApi api, java.lang.String channelId, java.lang.String messageId)
Unpins this message.- Parameters:
api- The discord api instance.channelId- The id of the message's channel.messageId- The id of the message.- Returns:
- A future to tell us if the action was successful.
-
unpin
default java.util.concurrent.CompletableFuture<java.lang.Void> unpin()
Unpins this message.- Returns:
- A future to tell us if the action was successful.
-
getContent
java.lang.String getContent()
Gets the content of the message.- Returns:
- The content of the message.
-
getLastEditTimestamp
java.util.Optional<java.time.Instant> getLastEditTimestamp()
Gets the last time the message was edited.- Returns:
- The last time the message was edited.
-
getAttachments
java.util.List<MessageAttachment> getAttachments()
Gets the attachments of the message.- Returns:
- The attachments of the message.
-
getReadableContent
default java.lang.String getReadableContent()
Gets the readable content of the message, which replaces all mentions etc. with the actual name. The replacement happens as following:- User mentions:
@nicknameif the user has a nickname,@nameif the user has no nickname, unchanged if the user is not in the cache. - Role mentions:
@nameif the role exists in the server, otherwise#deleted-role - Channel mentions:
#nameif the text channel exists in the server, otherwise#deleted-channel - Custom emoji:
:name:. If the emoji is known, the real name is used, otherwise the name from the mention tag.
- Returns:
- The readable content of the message.
- User mentions:
-
getLink
default java.net.URL getLink() throws java.lang.AssertionErrorGets the link leading to this message.- Returns:
- The message link.
- Throws:
java.lang.AssertionError- If the link is malformed.
-
getCustomEmojis
java.util.List<CustomEmoji> getCustomEmojis()
Gets a list of all custom emojis in the message.- Returns:
- The list of custom emojis in the message.
-
getType
MessageType getType()
Gets the type of the message.- Returns:
- The type of the message.
-
getChannel
TextChannel getChannel()
Gets the text channel of the message.- Returns:
- The text channel of the message.
-
getActivity
java.util.Optional<MessageActivity> getActivity()
Gets the activity of the message.- Returns:
- The activity of the message.
-
isPinned
boolean isPinned()
Checks if the message is pinned.- Returns:
- Whether the message is pinned or not.
-
isTts
boolean isTts()
Checks if this message is text-to-speech.- Returns:
- Whether this message is text-to-speech or not.
-
mentionsEveryone
boolean mentionsEveryone()
Checks if the message mentions everyone.- Returns:
- Whether the message mentions everyone or not.
-
getEmbeds
java.util.List<Embed> getEmbeds()
Gets a list with all embeds of the message.- Returns:
- A list with all embeds of the message.
-
getUserAuthor
java.util.Optional<User> getUserAuthor()
Gets the user author of the message. The author is not present, if it's a webhook.- Returns:
- The user author of the message.
-
getAuthor
MessageAuthor getAuthor()
Gets the author of the message. Might be a user or a webhook.- Returns:
- The author of the message.
-
getMessageReference
java.util.Optional<MessageReference> getMessageReference()
Gets the message reference of the message.- Returns:
- The message reference.
-
getReferencedMessage
java.util.Optional<Message> getReferencedMessage()
Gets the message referenced with a reply. Only present if this message is typeMessageType.REPLY, discord decided to send it and the message hasn't been deleted.- Returns:
- The referenced message.
-
requestReferencedMessage
default java.util.Optional<java.util.concurrent.CompletableFuture<Message>> requestReferencedMessage()
Requests the message referenced with a reply.If the message is in the cache, the message is served from the cache.
- Returns:
- The referenced message.
-
isCachedForever
boolean isCachedForever()
Checks if the message is kept in cache forever.- Returns:
- Whether the message is kept in cache forever or not.
-
setCachedForever
void setCachedForever(boolean cachedForever)
Sets if the message is kept in cache forever.- Parameters:
cachedForever- Whether the message should be kept in cache forever or not.
-
getReactions
java.util.List<Reaction> getReactions()
Gets a list with all reactions of the message.- Returns:
- A list which contains all reactions of the message.
-
getComponents
java.util.List<HighLevelComponent> getComponents()
Gets a list with all components of the message.- Returns:
- A list which contains all components of the message.
-
getMentionedUsers
java.util.List<User> getMentionedUsers()
Gets a list with all users mentioned in this message.- Returns:
- A list with all users mentioned in this message.
-
getMentionedRoles
java.util.List<Role> getMentionedRoles()
Gets a list with all roles mentioned in this message.- Returns:
- A list with all roles mentioned in this message.
-
getNonce
java.util.Optional<java.lang.String> getNonce()
Gets the nonce of the message.- Returns:
- The nonce of the message.
-
getStickerItems
java.util.Set<StickerItem> getStickerItems()
Gets the sticker items of the message.- Returns:
- The sticker items of the message.
-
getMentionedChannels
default java.util.List<ServerChannel> getMentionedChannels()
Gets a list with all channels mentioned in this message.- Returns:
- A list with all channels mentioned in this message.
-
isPrivateMessage
default boolean isPrivateMessage()
Checks if the message was sent in aprivate channel.- Returns:
- Whether the message was sent in a private channel.
-
isServerMessage
default boolean isServerMessage()
Checks if the message was sent in aserver channel.- Returns:
- Whether the message was sent in a server channel.
-
getReactionByEmoji
default java.util.Optional<Reaction> getReactionByEmoji(Emoji emoji)
Gets a reaction by its emoji.- Parameters:
emoji- The emoji of the reaction.- Returns:
- The reaction for the given emoji.
-
getReactionByEmoji
default java.util.Optional<Reaction> getReactionByEmoji(java.lang.String unicodeEmoji)
Gets a reaction by its unicode emoji.- Parameters:
unicodeEmoji- The unicode emoji of the reaction.- Returns:
- The reaction for the given emoji.
-
addReactions
default java.util.concurrent.CompletableFuture<java.lang.Void> addReactions(Emoji... emojis)
Adds reactions to the message.- Parameters:
emojis- The emojis.- Returns:
- A future to tell us if the action was successful.
-
addReactions
java.util.concurrent.CompletableFuture<java.lang.Void> addReactions(java.lang.String... unicodeEmojis)
Adds unicode reactions to the message.- Parameters:
unicodeEmojis- The unicode emoji strings.- Returns:
- A future to tell us if the action was successful.
-
removeReactionByEmoji
default java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionByEmoji(User user, Emoji emoji)
Removes a user from the list of reactors of a given emoji reaction.- Parameters:
user- The user to remove.emoji- The emoji of the reaction.- Returns:
- A future to tell us if the deletion was successful.
-
removeReactionByEmoji
java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionByEmoji(User user, java.lang.String unicodeEmoji)
Removes a user from the list of reactors of a given unicode emoji reaction.- Parameters:
user- The user to remove.unicodeEmoji- The unicode emoji of the reaction.- Returns:
- A future to tell us if the deletion was successful.
-
removeReactionByEmoji
default java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionByEmoji(Emoji emoji)
Removes all reactors of a given emoji reaction.- Parameters:
emoji- The emoji of the reaction.- Returns:
- A future to tell us if the deletion was successful.
-
removeReactionByEmoji
java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionByEmoji(java.lang.String unicodeEmoji)
Removes all reactors of a given unicode emoji reaction.- Parameters:
unicodeEmoji- The unicode emoji of the reaction.- Returns:
- A future to tell us if the deletion was successful.
-
removeReactionsByEmoji
default java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionsByEmoji(User user, Emoji... emojis)
Removes a user from the list of reactors of the given emoji reactions.- Parameters:
user- The user to remove.emojis- The emojis of the reactions.- Returns:
- A future to tell us if the deletion was successful.
-
removeReactionsByEmoji
java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionsByEmoji(User user, java.lang.String... unicodeEmojis)
Removes a user from the list of reactors of the given unicode emoji reactions.- Parameters:
unicodeEmojis- The unicode emojis of the reactions.user- The user to remove.- Returns:
- A future to tell us if the deletion was successful.
-
removeReactionsByEmoji
default java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionsByEmoji(Emoji... emojis)
Removes all reactors of the given emoji reactions.- Parameters:
emojis- The emojis of the reactions.- Returns:
- A future to tell us if the deletion was successful.
-
removeReactionsByEmoji
java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionsByEmoji(java.lang.String... unicodeEmojis)
Removes all reactors of the given unicode emoji reactions.- Parameters:
unicodeEmojis- The unicode emojis of the reactions.- Returns:
- A future to tell us if the deletion was successful.
-
removeOwnReactionByEmoji
default java.util.concurrent.CompletableFuture<java.lang.Void> removeOwnReactionByEmoji(Emoji emoji)
Removes you from the list of reactors of a given emoji reaction.- Parameters:
emoji- The emoji of the reaction.- Returns:
- A future to tell us if the deletion was successful.
-
removeOwnReactionByEmoji
java.util.concurrent.CompletableFuture<java.lang.Void> removeOwnReactionByEmoji(java.lang.String unicodeEmoji)
Removes you from the list of reactors of a given unicode emoji reaction.- Parameters:
unicodeEmoji- The unicode emoji of the reaction.- Returns:
- A future to tell us if the deletion was successful.
-
removeOwnReactionsByEmoji
default java.util.concurrent.CompletableFuture<java.lang.Void> removeOwnReactionsByEmoji(Emoji... emojis)
Removes you from the list of reactors of the given emoji reactions.- Parameters:
emojis- The emojis of the reactions.- Returns:
- A future to tell us if the deletion was successful.
-
removeOwnReactionsByEmoji
java.util.concurrent.CompletableFuture<java.lang.Void> removeOwnReactionsByEmoji(java.lang.String... unicodeEmojis)
Removes you from the list of reactors of the given unicode emoji reactions.- Parameters:
unicodeEmojis- The unicode emojis of the reactions.- Returns:
- A future to tell us if the deletion was successful.
-
getServerTextChannel
default java.util.Optional<ServerTextChannel> getServerTextChannel()
Gets the server text channel of the message. Only present if the message was sent in a server.- Returns:
- The server text channel.
-
getServerThreadChannel
default java.util.Optional<ServerThreadChannel> getServerThreadChannel()
Gets the server thread channel of the message. Only present if the message was sent in a thread in a server.- Returns:
- The server thread channel.
-
getPrivateChannel
default java.util.Optional<PrivateChannel> getPrivateChannel()
Gets the private channel of the message. Only present if the message was sent in a private conversation.- Returns:
- The private channel.
-
getServer
default java.util.Optional<Server> getServer()
Gets the server of the message.- Returns:
- The server of the message.
-
getMessagesBefore
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBefore(int limit)
Gets up to a given amount of messages before this message.- Parameters:
limit- The limit of messages to get.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBefore(int, long),getMessagesBeforeAsStream()
-
getMessagesBeforeUntil
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBeforeUntil(java.util.function.Predicate<Message> condition)
Gets messages before this message until one that meets the given condition is found. If no message matches the condition, an empty set is returned.- Parameters:
condition- The abort condition for when to stop retrieving messages.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBefore(int, long),getMessagesBeforeAsStream()
-
getMessagesBeforeWhile
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBeforeWhile(java.util.function.Predicate<Message> condition)
Gets messages before this message while they meet the given condition. If the first message does not match the condition, an empty set is returned.- Parameters:
condition- The condition that has to be met.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBeforeWhile(Predicate, long),getMessagesBeforeAsStream()
-
getMessagesBeforeAsStream
default java.util.stream.Stream<Message> getMessagesBeforeAsStream()
Gets a stream of messages before this message sorted from newest to oldest.The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.
- Returns:
- The stream.
- See Also:
TextChannel.getMessagesBeforeAsStream(long),getMessagesBefore(int)
-
getMessagesAfter
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesAfter(int limit)
Gets up to a given amount of messages after this message.- Parameters:
limit- The limit of messages to get.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesAfter(int, long),getMessagesAfterAsStream()
-
getMessagesAfterUntil
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesAfterUntil(java.util.function.Predicate<Message> condition)
Gets messages after this message until one that meets the given condition is found. If no message matches the condition, an empty set is returned.- Parameters:
condition- The abort condition for when to stop retrieving messages.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesAfter(int, long),getMessagesAfterAsStream()
-
getMessagesAfterWhile
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesAfterWhile(java.util.function.Predicate<Message> condition)
Gets messages after this message while they meet the given condition. If the first message does not match the condition, an empty set is returned.- Parameters:
condition- The condition that has to be met.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesAfterWhile(Predicate, long),getMessagesAfterAsStream()
-
getMessagesAfterAsStream
default java.util.stream.Stream<Message> getMessagesAfterAsStream()
Gets a stream of messages after this message sorted from oldest to newest.The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.
- Returns:
- The stream.
- See Also:
TextChannel.getMessagesAfterAsStream(long),getMessagesAfter(int)
-
getMessagesAround
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesAround(int limit)
Gets up to a given amount of messages around this message. This message will be part of the result in addition to the messages around and does not count towards the limit. Half of the messages will be older than this message and half of the message will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.- Parameters:
limit- The limit of messages to get.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesAround(int, long),getMessagesAroundAsStream()
-
getMessagesAroundUntil
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesAroundUntil(java.util.function.Predicate<Message> condition)
Gets messages around this message until one that meets the given condition is found. If no message matches the condition, an empty set is returned. This message will be part of the result in addition to the messages around and is matched against the condition and will abort retrieval. Half of the messages will be older than this message and half of the message will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.- Parameters:
condition- The abort condition for when to stop retrieving messages.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesAround(int, long),getMessagesAroundAsStream()
-
getMessagesAroundWhile
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesAroundWhile(java.util.function.Predicate<Message> condition)
Gets messages around this message while they meet the given condition. If this message does not match the condition, an empty set is returned. This message will be part of the result in addition to the messages around and is matched against the condition and will abort retrieval. Half of the messages will be older than this message and half of the message will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.- Parameters:
condition- The condition that has to be met.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesAroundWhile(Predicate, long),getMessagesAroundAsStream()
-
getMessagesAroundAsStream
default java.util.stream.Stream<Message> getMessagesAroundAsStream()
Gets a stream of messages around this message. The first message in the stream will be this message. After that you will always get an older message and a newer message alternating as long as on both sides messages are available. If only on one side further messages are available, only those are delivered further on. It's not guaranteed to be perfectly balanced.The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.
- Returns:
- The stream.
- See Also:
TextChannel.getMessagesAroundAsStream(long),getMessagesAround(int)
-
getMessagesBetween
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetween(long other)
Gets all messages between this message and the given message, excluding the boundaries.- Parameters:
other- The id of the other boundary messages.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBetween(long, long),getMessagesBetweenAsStream(long)
-
getMessagesBetween
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetween(Message other)
Gets all messages between this message and the given message, excluding the boundaries.- Parameters:
other- The other boundary messages.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBetween(long, long),getMessagesBetweenAsStream(long)
-
getMessagesBetweenUntil
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetweenUntil(long other, java.util.function.Predicate<Message> condition)
Gets all messages between this message and the given message, excluding the boundaries, until one that meets the given condition is found. If no message matches the condition, an empty set is returned.- Parameters:
other- The id of the other boundary messages.condition- The abort condition for when to stop retrieving messages.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBetweenUntil(Predicate, long, long),getMessagesBetweenAsStream(long)
-
getMessagesBetweenUntil
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetweenUntil(Message other, java.util.function.Predicate<Message> condition)
Gets all messages between this message and the given message, excluding the boundaries, until one that meets the given condition is found. If no message matches the condition, an empty set is returned.- Parameters:
other- The other boundary messages.condition- The abort condition for when to stop retrieving messages.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBetweenUntil(Predicate, long, long),getMessagesBetweenAsStream(long)
-
getMessagesBetweenWhile
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetweenWhile(long other, java.util.function.Predicate<Message> condition)
Gets all messages between this message and the given message, excluding the boundaries, while they meet the given condition. If the first message does not match the condition, an empty set is returned.- Parameters:
other- The id of the other boundary messages.condition- The condition that has to be met.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBetweenWhile(Predicate, long, long),getMessagesBetweenAsStream(long)
-
getMessagesBetweenWhile
default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetweenWhile(Message other, java.util.function.Predicate<Message> condition)
Gets all messages between this message and the given message, excluding the boundaries, while they meet the given condition. If the first message does not match the condition, an empty set is returned.- Parameters:
other- The other boundary messages.condition- The condition that has to be met.- Returns:
- The messages.
- See Also:
TextChannel.getMessagesBetweenWhile(Predicate, long, long),getMessagesBetweenAsStream(long)
-
getMessagesBetweenAsStream
default java.util.stream.Stream<Message> getMessagesBetweenAsStream(long other)
Gets a stream of all messages between this message and the given message, excluding the boundaries, sorted from this message to the given message.The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.
- Parameters:
other- The id of the other boundary messages.- Returns:
- The stream.
- See Also:
TextChannel.getMessagesBetweenAsStream(long, long),getMessagesBetween(long)
-
getMessagesBetweenAsStream
default java.util.stream.Stream<Message> getMessagesBetweenAsStream(Message other)
Gets a stream of all messages between this message and the given message, excluding the boundaries, sorted from this message to the given message.The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.
- Parameters:
other- The other boundary messages.- Returns:
- The stream.
- See Also:
TextChannel.getMessagesBetweenAsStream(long, long),getMessagesBetween(long)
-
canAddNewReactions
default boolean canAddNewReactions(User user)
Checks if the given user is allowed to add new reactions to the message.- Parameters:
user- The user to check.- Returns:
- Whether the given user is allowed to add new reactions to the message or not.
-
canYouAddNewReactions
default boolean canYouAddNewReactions()
Checks if the user of the connected account is allowed to add new reactions to the message.- Returns:
- Whether the user of the connected account is allowed to add new reactions to the message or not.
-
canDelete
default boolean canDelete(User user)
Checks if the given user can delete this message.- Parameters:
user- The user to check.- Returns:
- Whether the given user can delete the message or not.
-
reply
default java.util.concurrent.CompletableFuture<Message> reply(java.lang.String messageContent)
Replies to this message with the given text.- Parameters:
messageContent- The text to reply with.- Returns:
- The sent message.
-
reply
default java.util.concurrent.CompletableFuture<Message> reply(EmbedBuilder embed)
Replies to this message with the given embed.- Parameters:
embed- The EmbedBuilder to reply with.- Returns:
- The sent message.
-
canYouDelete
default boolean canYouDelete()
Checks if the user of the connected account can delete this message.- Returns:
- Whether the user of the connected account can delete the message or not.
-
getCurrentCachedInstance
default java.util.Optional<Message> getCurrentCachedInstance()
Description copied from interface:UpdatableFromCacheGets an updated instance of this entity from the cache. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache, that gets updates from Discord, in case this one was invalidated.This method returns the currently cached entity, or an empty
Optionalif the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.- Specified by:
getCurrentCachedInstancein interfaceUpdatableFromCache<Message>- Returns:
- The current cached instance.
-
getLatestInstance
default java.util.concurrent.CompletableFuture<Message> getLatestInstance()
Description copied from interface:UpdatableGets an updated instance of this entity from the cache or from Discord directly. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache if present or from Discord directly.This method returns the currently cached entity if present, or request the entity from Discord if it is not cached or not permanently cached. If the entity is a fully cached entity and is not in the cache any longer, for example because it was deleted or the message was thrown out of the cache, the
CompletableFuturecompletes exceptionally with aNoSuchElementException. If a request to Discord is made, the according remote call exception will be used to complete theCompletableFutureexceptionally.- Specified by:
getLatestInstancein interfaceUpdatable<Message>- Specified by:
getLatestInstancein interfaceUpdatableFromCache<Message>- Returns:
- The current cached instance.
-
createThread
default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThread(java.lang.String name, AutoArchiveDuration autoArchiveDuration)
Creates a thread for this message.- Parameters:
name- The Thread name.autoArchiveDuration- Duration in minutes to automatically archive the thread after recent activity.- Returns:
- The created ServerThreadChannel.
-
createThread
default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThread(java.lang.String name, java.lang.Integer autoArchiveDuration)
Creates a thread for this message.- Parameters:
name- The Thread name.autoArchiveDuration- Duration in minutes to automatically archive the thread after recent activity.- Returns:
- The created ServerThreadChannel.
-
-