Package org.javacord.api.entity.message
Class MessageUpdater
- java.lang.Object
-
- org.javacord.api.entity.message.MessageUpdater
-
public class MessageUpdater extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected MessageBuilderBaseDelegatedelegateThe message delegate used by this instance.
-
Constructor Summary
Constructors Constructor Description MessageUpdater(Message m)Class constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaddActionRow(LowLevelComponent... components)Add multiple low level components, wrapped in an ActionRow, to the message.TaddAttachment(byte[] bytes, java.lang.String fileName)Adds an attachment to the message.TaddAttachment(byte[] bytes, java.lang.String fileName, java.lang.String description)Adds an attachment to the message.TaddAttachment(java.awt.image.BufferedImage image, java.lang.String fileName)Adds an attachment to the message.TaddAttachment(java.awt.image.BufferedImage image, java.lang.String fileName, java.lang.String description)Adds an attachment to the message.TaddAttachment(java.io.File file)Adds an attachment to the message.TaddAttachment(java.io.File file, java.lang.String description)Adds an attachment to the message.TaddAttachment(java.io.InputStream stream, java.lang.String fileName)Adds an attachment to the message.TaddAttachment(java.io.InputStream stream, java.lang.String fileName, java.lang.String description)Adds an attachment to the message.TaddAttachment(java.net.URL url)Adds an attachment to the message.TaddAttachment(java.net.URL url, java.lang.String description)Adds an attachment to the message.TaddAttachment(Icon icon)Adds an attachment to the message.TaddAttachment(Icon icon, java.lang.String description)Adds an attachment to the message.TaddAttachmentAsSpoiler(byte[] bytes, java.lang.String fileName)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(byte[] bytes, java.lang.String fileName, java.lang.String description)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(java.awt.image.BufferedImage image, java.lang.String fileName)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(java.awt.image.BufferedImage image, java.lang.String fileName, java.lang.String description)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(java.io.File file)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(java.io.File file, java.lang.String description)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(java.io.InputStream stream, java.lang.String fileName)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(java.io.InputStream stream, java.lang.String fileName, java.lang.String description)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(java.net.URL url)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(java.net.URL url, java.lang.String description)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(Icon icon)Adds an attachment to the message and marks it as spoiler.TaddAttachmentAsSpoiler(Icon icon, java.lang.String description)Adds an attachment to the message and marks it as spoiler.TaddComponents(HighLevelComponent... components)Add multiple high level components to the message.TaddEmbed(EmbedBuilder embed)Adds an embed to the message.TaddEmbeds(java.util.List<EmbedBuilder> embeds)Adds the embeds to the message.TaddEmbeds(EmbedBuilder... embeds)Adds the embeds to the message.Tappend(java.lang.Object object)Appends the string representation of the object (callingString.valueOf(Object)method) to the message.Tappend(java.lang.String message, MessageDecoration... decorations)Appends a sting with or without decoration to the message.Tappend(Mentionable entity)Appends a mentionable entity (usually a user or channel) to the message.TappendCode(java.lang.String language, java.lang.String code)Appends code to the message.TappendNewLine()Appends a new line to the message.TappendTimestamp(long epochSeconds)Appends a timestamp to the message with the default timestamp styleTimestampStyle.SHORT_DATE_TIME.TappendTimestamp(long epochSeconds, TimestampStyle timestampStyle)Appends a timestamp to the message.TappendTimestamp(java.time.Instant instant)Appends a timestamp to the message with the default timestamp styleTimestampStyle.SHORT_DATE_TIME.TappendTimestamp(java.time.Instant instant, TimestampStyle timestampStyle)Appends a timestamp to the message.java.util.concurrent.CompletableFuture<Message>applyChanges()Edits the message, updating all fields that have been changed by a method call.java.lang.StringBuildergetStringBuilder()Gets theStringBuilderwhich is used to build the message.TremoveAllComponents()Remove all high-level components from the message.TremoveAllEmbeds()Removes all embeds from the message.TremoveContent()Removes the content of the message.TremoveEmbed(EmbedBuilder embed)Removes the embed from the message.TremoveEmbeds(EmbedBuilder... embeds)Removes the embeds from the message.MessageUpdaterremoveExistingAttachment(Attachment attachment)Removes an attachment from the message.MessageUpdaterremoveExistingAttachments()Removes all the attachments from the message.MessageUpdaterremoveExistingAttachments(java.util.Collection<Attachment> attachments)Removes multiple attachments from the message.MessageUpdaterremoveExistingAttachments(Attachment... attachments)Removes multiple attachments from the message.java.util.concurrent.CompletableFuture<Message>replaceMessage()Edits the message, updating all fields.TsetAllowedMentions(AllowedMentions allowedMentions)Controls who will be mentioned if mentions exist in the message.TsetContent(java.lang.String content)Sets the content of the message.TsetEmbed(EmbedBuilder embed)Sets the embed of the message (overrides all existing embeds).TsetEmbeds(java.util.List<EmbedBuilder> embeds)Sets multiple embeds of the message (overrides all existing embeds).TsetEmbeds(EmbedBuilder... embeds)Sets multiple embeds of the message (overrides all existing embeds).TsetNonce(java.lang.String nonce)Sets the nonce of the message.
-
-
-
Field Detail
-
delegate
protected final MessageBuilderBaseDelegate delegate
The message delegate used by this instance.
-
-
Constructor Detail
-
MessageUpdater
public MessageUpdater(Message m)
Class constructor.- Parameters:
m- The message to update.
-
-
Method Detail
-
applyChanges
public java.util.concurrent.CompletableFuture<Message> applyChanges()
Edits the message, updating all fields that have been changed by a method call. For example, the content of the message will only be patched if you called a method on this updater that affects the content.- Returns:
- The edited message.
-
replaceMessage
public java.util.concurrent.CompletableFuture<Message> replaceMessage()
Edits the message, updating all fields. Fields that have not been set will be dropped and removed from the actual message on Discord.- Returns:
- The edited message.
-
removeExistingAttachment
public MessageUpdater removeExistingAttachment(Attachment attachment)
Removes an attachment from the message.- Parameters:
attachment- The attachment to remove.- Returns:
- The current instance in order to chain call methods.
-
removeExistingAttachments
public MessageUpdater removeExistingAttachments()
Removes all the attachments from the message.- Returns:
- The current instance in order to chain call methods.
-
removeExistingAttachments
public MessageUpdater removeExistingAttachments(Attachment... attachments)
Removes multiple attachments from the message.- Parameters:
attachments- The attachments to remove.- Returns:
- The current instance in order to chain call methods.
-
removeExistingAttachments
public MessageUpdater removeExistingAttachments(java.util.Collection<Attachment> attachments)
Removes multiple attachments from the message.- Parameters:
attachments- The attachments to remove.- Returns:
- The current instance in order to chain call methods.
-
addComponents
public T addComponents(HighLevelComponent... components)
Add multiple high level components to the message.- Parameters:
components- The high level components.- Returns:
- The current instance in order to chain call methods.
-
addActionRow
public T addActionRow(LowLevelComponent... components)
Add multiple low level components, wrapped in an ActionRow, to the message.- Parameters:
components- The low level components.- Returns:
- The current instance in order to chain call methods.
-
appendCode
public T appendCode(java.lang.String language, java.lang.String code)Appends code to the message.- Parameters:
language- The language, e.g. "java".code- The code.- Returns:
- The current instance in order to chain call methods.
-
appendTimestamp
public T appendTimestamp(long epochSeconds)
Appends a timestamp to the message with the default timestamp styleTimestampStyle.SHORT_DATE_TIME.- Parameters:
epochSeconds- The epoch time in seconds.- Returns:
- The current instance in order to chain call methods.
-
appendTimestamp
public T appendTimestamp(java.time.Instant instant)
Appends a timestamp to the message with the default timestamp styleTimestampStyle.SHORT_DATE_TIME.- Parameters:
instant- The instant for the displaying timestamp.- Returns:
- The current instance in order to chain call methods.
-
appendTimestamp
public T appendTimestamp(long epochSeconds, TimestampStyle timestampStyle)Appends a timestamp to the message.- Parameters:
epochSeconds- The epoch time in seconds.timestampStyle- The displayed timestamp style.- Returns:
- The current instance in order to chain call methods.
-
appendTimestamp
public T appendTimestamp(java.time.Instant instant, TimestampStyle timestampStyle)Appends a timestamp to the message.- Parameters:
instant- The instant for the displaying timestamp.timestampStyle- The displayed timestamp style.- Returns:
- The current instance in order to chain call methods.
-
append
public T append(java.lang.String message, MessageDecoration... decorations)Appends a sting with or without decoration to the message.- Parameters:
message- The string to append.decorations- The decorations of the string.- Returns:
- The current instance in order to chain call methods.
-
append
public T append(Mentionable entity)
Appends a mentionable entity (usually a user or channel) to the message.- Parameters:
entity- The entity to mention.- Returns:
- The current instance in order to chain call methods.
-
append
public T append(java.lang.Object object)
Appends the string representation of the object (callingString.valueOf(Object)method) to the message.- Parameters:
object- The object to append.- Returns:
- The current instance in order to chain call methods.
- See Also:
StringBuilder.append(Object)
-
appendNewLine
public T appendNewLine()
Appends a new line to the message.- Returns:
- The current instance in order to chain call methods.
-
setContent
public T setContent(java.lang.String content)
Sets the content of the message. This method overwrites all previous content changes (usingappend(String, MessageDecoration...)for example).- Parameters:
content- The new content of the message.- Returns:
- The current instance in order to chain call methods.
-
removeContent
public T removeContent()
Removes the content of the message. This method overwrites all previous content changes (usingappend(String, MessageDecoration...)for example).- Returns:
- The current instance in order to chain call methods.
-
setEmbed
public T setEmbed(EmbedBuilder embed)
Sets the embed of the message (overrides all existing embeds).- Parameters:
embed- The embed to set.- Returns:
- The current instance in order to chain call methods.
-
setEmbeds
public T setEmbeds(EmbedBuilder... embeds)
Sets multiple embeds of the message (overrides all existing embeds).- Parameters:
embeds- The embed to set.- Returns:
- The current instance in order to chain call methods.
-
setEmbeds
public T setEmbeds(java.util.List<EmbedBuilder> embeds)
Sets multiple embeds of the message (overrides all existing embeds).- Parameters:
embeds- The embed to set.- Returns:
- The current instance in order to chain call methods.
-
addEmbed
public T addEmbed(EmbedBuilder embed)
Adds an embed to the message.- Parameters:
embed- The embed to add.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(java.awt.image.BufferedImage image, java.lang.String fileName)Adds an attachment to the message.- Parameters:
image- The image to add as an attachment.fileName- The file name of the image.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(java.awt.image.BufferedImage image, java.lang.String fileName, java.lang.String description)Adds an attachment to the message.- Parameters:
image- The image to add as an attachment.fileName- The file name of the image.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(java.io.File file)
Adds an attachment to the message.- Parameters:
file- The file to add as an attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(java.io.File file, java.lang.String description)Adds an attachment to the message.- Parameters:
file- The file to add as an attachment.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(Icon icon)
Adds an attachment to the message.- Parameters:
icon- The icon to add as an attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(Icon icon, java.lang.String description)
Adds an attachment to the message.- Parameters:
icon- The icon to add as an attachment.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(java.net.URL url)
Adds an attachment to the message.- Parameters:
url- The url of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(java.net.URL url, java.lang.String description)Adds an attachment to the message.- Parameters:
url- The url of the attachment.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(byte[] bytes, java.lang.String fileName)Adds an attachment to the message.- Parameters:
bytes- The bytes of the file.fileName- The name of the file.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(byte[] bytes, java.lang.String fileName, java.lang.String description)Adds an attachment to the message.- Parameters:
bytes- The bytes of the file.fileName- The name of the file.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(java.io.InputStream stream, java.lang.String fileName)Adds an attachment to the message.- Parameters:
stream- The stream of the file.fileName- The name of the file.- Returns:
- The current instance in order to chain call methods.
-
addAttachment
public T addAttachment(java.io.InputStream stream, java.lang.String fileName, java.lang.String description)Adds an attachment to the message.- Parameters:
stream- The stream of the file.fileName- The name of the file.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(java.awt.image.BufferedImage image, java.lang.String fileName)Adds an attachment to the message and marks it as spoiler.- Parameters:
image- The image to add as an attachment.fileName- The file name of the image.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(java.awt.image.BufferedImage image, java.lang.String fileName, java.lang.String description)Adds an attachment to the message and marks it as spoiler.- Parameters:
image- The image to add as an attachment.fileName- The file name of the image.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(java.io.File file)
Adds an attachment to the message and marks it as spoiler.- Parameters:
file- The file to add as an attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(java.io.File file, java.lang.String description)Adds an attachment to the message and marks it as spoiler.- Parameters:
file- The file to add as an attachment.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(Icon icon)
Adds an attachment to the message and marks it as spoiler.- Parameters:
icon- The icon to add as an attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(Icon icon, java.lang.String description)
Adds an attachment to the message and marks it as spoiler.- Parameters:
icon- The icon to add as an attachment.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(java.net.URL url)
Adds an attachment to the message and marks it as spoiler.- Parameters:
url- The url of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(java.net.URL url, java.lang.String description)Adds an attachment to the message and marks it as spoiler.- Parameters:
url- The url of the attachment.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(byte[] bytes, java.lang.String fileName)Adds an attachment to the message and marks it as spoiler.- Parameters:
bytes- The bytes of the file.fileName- The name of the file.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(byte[] bytes, java.lang.String fileName, java.lang.String description)Adds an attachment to the message and marks it as spoiler.- Parameters:
bytes- The bytes of the file.fileName- The name of the file.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(java.io.InputStream stream, java.lang.String fileName)Adds an attachment to the message and marks it as spoiler.- Parameters:
stream- The stream of the file.fileName- The name of the file.- Returns:
- The current instance in order to chain call methods.
-
addAttachmentAsSpoiler
public T addAttachmentAsSpoiler(java.io.InputStream stream, java.lang.String fileName, java.lang.String description)Adds an attachment to the message and marks it as spoiler.- Parameters:
stream- The stream of the file.fileName- The name of the file.description- The description of the attachment.- Returns:
- The current instance in order to chain call methods.
-
setAllowedMentions
public T setAllowedMentions(AllowedMentions allowedMentions)
Controls who will be mentioned if mentions exist in the message.- Parameters:
allowedMentions- The mention object.- Returns:
- The current instance in order to chain call methods.
-
removeAllComponents
public T removeAllComponents()
Remove all high-level components from the message.- Returns:
- The current instance in order to chain call methods.
-
addEmbeds
public T addEmbeds(EmbedBuilder... embeds)
Adds the embeds to the message.- Parameters:
embeds- The embeds to add.- Returns:
- The current instance in order to chain call methods.
-
addEmbeds
public T addEmbeds(java.util.List<EmbedBuilder> embeds)
Adds the embeds to the message.- Parameters:
embeds- The embeds to add.- Returns:
- The current instance in order to chain call methods.
-
removeEmbed
public T removeEmbed(EmbedBuilder embed)
Removes the embed from the message.- Parameters:
embed- The embed to remove.- Returns:
- The current instance in order to chain call methods.
-
removeEmbeds
public T removeEmbeds(EmbedBuilder... embeds)
Removes the embeds from the message.- Parameters:
embeds- The embeds to remove.- Returns:
- The current instance in order to chain call methods.
-
removeAllEmbeds
public T removeAllEmbeds()
Removes all embeds from the message.- Returns:
- The current instance in order to chain call methods.
-
setNonce
public T setNonce(java.lang.String nonce)
Sets the nonce of the message.- Parameters:
nonce- The nonce to set.- Returns:
- The current instance in order to chain call methods.
-
getStringBuilder
public java.lang.StringBuilder getStringBuilder()
Gets theStringBuilderwhich is used to build the message.- Returns:
- The StringBuilder which is used to build the message.
-
-