Package org.javacord.core.entity.message
Class MessageBuilderBaseDelegateImpl
- java.lang.Object
-
- org.javacord.core.entity.message.MessageBuilderBaseDelegateImpl
-
- All Implemented Interfaces:
MessageBuilderBaseDelegate
- Direct Known Subclasses:
InteractionMessageBuilderDelegateImpl
,WebhookMessageBuilderDelegateImpl
public class MessageBuilderBaseDelegateImpl extends java.lang.Object implements MessageBuilderBaseDelegate
The implementation ofMessageBuilderBaseDelegate
.
-
-
Field Summary
Fields Modifier and Type Field Description protected AllowedMentions
allowedMentions
The MentionsBuilder used to control mention behavior.protected boolean
attachmentsChanged
True if the attachments have been changed by the user.protected java.util.List<Attachment>
attachmentsToRemove
All the attachments that should be removed from the message.protected java.util.List<HighLevelComponent>
components
All components which should be added to the message.protected boolean
componentsChanged
True if the components have been changed by the user.protected boolean
contentChanged
True if the content has been changed by the user.protected java.util.List<EmbedBuilder>
embeds
The list of embeds of the message.protected boolean
embedsChanged
True if embeds have been changed by the user.protected java.util.List<FileContainer>
newAttachments
All attachments which should be added to the message.protected java.lang.String
nonce
The nonce of the message.protected boolean
removeAllAttachments
Used to indicate that all the attachments in the message should be removed.protected java.lang.Long
replyingTo
The message to reply to.protected java.util.Set<java.lang.Long>
stickerIds
The stickers attached to the message.protected java.lang.StringBuilder
strBuilder
The string builder used to create the message.protected boolean
tts
If the message should be text to speech or not.
-
Constructor Summary
Constructors Constructor Description MessageBuilderBaseDelegateImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addActionRow(LowLevelComponent... lowLevelComponents)
void
addAttachment(byte[] bytes, java.lang.String fileName, java.lang.String description)
void
addAttachment(java.awt.image.BufferedImage image, java.lang.String fileName, java.lang.String description)
void
addAttachment(java.io.File file, java.lang.String description)
void
addAttachment(java.io.InputStream stream, java.lang.String fileName, java.lang.String description)
void
addAttachment(java.net.URL url, java.lang.String description)
void
addAttachment(Icon icon, java.lang.String description)
void
addAttachmentAsSpoiler(java.io.File file, java.lang.String description)
void
addAttachmentAsSpoiler(java.net.URL url, java.lang.String description)
void
addAttachmentAsSpoiler(Icon icon, java.lang.String description)
void
addComponents(HighLevelComponent... highLevelComponents)
void
addEmbed(EmbedBuilder embed)
void
addEmbeds(java.util.List<EmbedBuilder> embeds)
protected void
addMultipartBodyToRequest(RestRequest<?> request, com.fasterxml.jackson.databind.node.ObjectNode body, java.util.List<FileContainer> attachments, DiscordApi api)
Method which creates and adds a MultipartBody to a RestRequest.void
addSticker(long stickerId)
void
addStickers(java.util.Collection<java.lang.Long> stickerIds)
void
append(java.lang.Object object)
void
append(java.lang.String message, MessageDecoration... decorations)
void
append(Mentionable entity)
void
appendCode(java.lang.String language, java.lang.String code)
void
appendNamedLink(java.lang.String name, java.lang.String url)
void
appendNewLine()
void
copy(Message message)
Fill the builder's values with a message.java.util.concurrent.CompletableFuture<Message>
edit(Message message, boolean updateAll)
java.lang.StringBuilder
getStringBuilder()
protected void
prepareCommonWebhookMessageBodyParts(com.fasterxml.jackson.databind.node.ObjectNode body)
protected void
prepareComponents(com.fasterxml.jackson.databind.node.ObjectNode body)
protected void
prepareComponents(com.fasterxml.jackson.databind.node.ObjectNode body, boolean evenIfEmpty)
void
removeAllComponents()
void
removeAllEmbeds()
void
removeComponent(int index)
void
removeComponent(HighLevelComponent component)
void
removeEmbed(EmbedBuilder embed)
void
removeEmbeds(EmbedBuilder... embeds)
void
removeExistingAttachment(Attachment attachment)
void
removeExistingAttachments()
void
removeExistingAttachments(java.util.Collection<Attachment> attachments)
void
replyTo(long messageId, boolean assertReferenceExists)
protected java.util.concurrent.CompletableFuture<Message>
send(java.lang.String webhookId, java.lang.String webhookToken, java.lang.String displayName, java.net.URL avatarUrl, boolean wait, DiscordApi api)
Send a message to an incoming webhook.java.util.concurrent.CompletableFuture<Message>
send(TextChannel channel)
java.util.concurrent.CompletableFuture<Message>
send(Messageable messageable)
java.util.concurrent.CompletableFuture<Message>
send(User user)
java.util.concurrent.CompletableFuture<Message>
send(IncomingWebhook webhook)
java.util.concurrent.CompletableFuture<Message>
sendWithWebhook(DiscordApi api, java.lang.String webhookId, java.lang.String webhookToken)
void
setAllowedMentions(AllowedMentions allowedMentions)
void
setContent(java.lang.String content)
void
setNonce(java.lang.String nonce)
void
setTts(boolean tts)
java.lang.String
toString()
-
-
-
Field Detail
-
strBuilder
protected final java.lang.StringBuilder strBuilder
The string builder used to create the message.
-
contentChanged
protected boolean contentChanged
True if the content has been changed by the user.
-
embeds
protected java.util.List<EmbedBuilder> embeds
The list of embeds of the message.
-
embedsChanged
protected boolean embedsChanged
True if embeds have been changed by the user.
-
tts
protected boolean tts
If the message should be text to speech or not.
-
nonce
protected java.lang.String nonce
The nonce of the message.
-
newAttachments
protected final java.util.List<FileContainer> newAttachments
All attachments which should be added to the message.
-
removeAllAttachments
protected boolean removeAllAttachments
Used to indicate that all the attachments in the message should be removed.
-
attachmentsToRemove
protected final java.util.List<Attachment> attachmentsToRemove
All the attachments that should be removed from the message.
-
attachmentsChanged
protected boolean attachmentsChanged
True if the attachments have been changed by the user.
-
components
protected final java.util.List<HighLevelComponent> components
All components which should be added to the message.
-
componentsChanged
protected boolean componentsChanged
True if the components have been changed by the user.
-
allowedMentions
protected AllowedMentions allowedMentions
The MentionsBuilder used to control mention behavior.
-
replyingTo
protected java.lang.Long replyingTo
The message to reply to.
-
stickerIds
protected java.util.Set<java.lang.Long> stickerIds
The stickers attached to the message.
-
-
Method Detail
-
addComponents
public void addComponents(HighLevelComponent... highLevelComponents)
- Specified by:
addComponents
in interfaceMessageBuilderBaseDelegate
-
addActionRow
public void addActionRow(LowLevelComponent... lowLevelComponents)
- Specified by:
addActionRow
in interfaceMessageBuilderBaseDelegate
-
appendCode
public void appendCode(java.lang.String language, java.lang.String code)
- Specified by:
appendCode
in interfaceMessageBuilderBaseDelegate
-
append
public void append(java.lang.String message, MessageDecoration... decorations)
- Specified by:
append
in interfaceMessageBuilderBaseDelegate
-
append
public void append(Mentionable entity)
- Specified by:
append
in interfaceMessageBuilderBaseDelegate
-
append
public void append(java.lang.Object object)
- Specified by:
append
in interfaceMessageBuilderBaseDelegate
-
appendNamedLink
public void appendNamedLink(java.lang.String name, java.lang.String url)
- Specified by:
appendNamedLink
in interfaceMessageBuilderBaseDelegate
-
appendNewLine
public void appendNewLine()
- Specified by:
appendNewLine
in interfaceMessageBuilderBaseDelegate
-
setContent
public void setContent(java.lang.String content)
- Specified by:
setContent
in interfaceMessageBuilderBaseDelegate
-
removeExistingAttachment
public void removeExistingAttachment(Attachment attachment)
- Specified by:
removeExistingAttachment
in interfaceMessageBuilderBaseDelegate
-
removeExistingAttachments
public void removeExistingAttachments()
- Specified by:
removeExistingAttachments
in interfaceMessageBuilderBaseDelegate
-
removeExistingAttachments
public void removeExistingAttachments(java.util.Collection<Attachment> attachments)
- Specified by:
removeExistingAttachments
in interfaceMessageBuilderBaseDelegate
-
addEmbed
public void addEmbed(EmbedBuilder embed)
- Specified by:
addEmbed
in interfaceMessageBuilderBaseDelegate
-
copy
public void copy(Message message)
Fill the builder's values with a message.- Specified by:
copy
in interfaceMessageBuilderBaseDelegate
- Parameters:
message
- The message to copy.
-
removeAllEmbeds
public void removeAllEmbeds()
- Specified by:
removeAllEmbeds
in interfaceMessageBuilderBaseDelegate
-
addEmbeds
public void addEmbeds(java.util.List<EmbedBuilder> embeds)
- Specified by:
addEmbeds
in interfaceMessageBuilderBaseDelegate
-
removeEmbed
public void removeEmbed(EmbedBuilder embed)
- Specified by:
removeEmbed
in interfaceMessageBuilderBaseDelegate
-
removeEmbeds
public void removeEmbeds(EmbedBuilder... embeds)
- Specified by:
removeEmbeds
in interfaceMessageBuilderBaseDelegate
-
removeComponent
public void removeComponent(int index)
- Specified by:
removeComponent
in interfaceMessageBuilderBaseDelegate
-
removeComponent
public void removeComponent(HighLevelComponent component)
- Specified by:
removeComponent
in interfaceMessageBuilderBaseDelegate
-
removeAllComponents
public void removeAllComponents()
- Specified by:
removeAllComponents
in interfaceMessageBuilderBaseDelegate
-
setTts
public void setTts(boolean tts)
- Specified by:
setTts
in interfaceMessageBuilderBaseDelegate
-
addAttachment
public void addAttachment(java.awt.image.BufferedImage image, java.lang.String fileName, java.lang.String description)
- Specified by:
addAttachment
in interfaceMessageBuilderBaseDelegate
-
addAttachment
public void addAttachment(java.io.File file, java.lang.String description)
- Specified by:
addAttachment
in interfaceMessageBuilderBaseDelegate
-
addAttachment
public void addAttachment(Icon icon, java.lang.String description)
- Specified by:
addAttachment
in interfaceMessageBuilderBaseDelegate
-
addAttachment
public void addAttachment(java.net.URL url, java.lang.String description)
- Specified by:
addAttachment
in interfaceMessageBuilderBaseDelegate
-
addAttachment
public void addAttachment(byte[] bytes, java.lang.String fileName, java.lang.String description)
- Specified by:
addAttachment
in interfaceMessageBuilderBaseDelegate
-
addAttachment
public void addAttachment(java.io.InputStream stream, java.lang.String fileName, java.lang.String description)
- Specified by:
addAttachment
in interfaceMessageBuilderBaseDelegate
-
addAttachmentAsSpoiler
public void addAttachmentAsSpoiler(java.io.File file, java.lang.String description)
- Specified by:
addAttachmentAsSpoiler
in interfaceMessageBuilderBaseDelegate
-
addAttachmentAsSpoiler
public void addAttachmentAsSpoiler(Icon icon, java.lang.String description)
- Specified by:
addAttachmentAsSpoiler
in interfaceMessageBuilderBaseDelegate
-
addAttachmentAsSpoiler
public void addAttachmentAsSpoiler(java.net.URL url, java.lang.String description)
- Specified by:
addAttachmentAsSpoiler
in interfaceMessageBuilderBaseDelegate
-
setAllowedMentions
public void setAllowedMentions(AllowedMentions allowedMentions)
- Specified by:
setAllowedMentions
in interfaceMessageBuilderBaseDelegate
-
replyTo
public void replyTo(long messageId, boolean assertReferenceExists)
- Specified by:
replyTo
in interfaceMessageBuilderBaseDelegate
-
setNonce
public void setNonce(java.lang.String nonce)
- Specified by:
setNonce
in interfaceMessageBuilderBaseDelegate
-
addSticker
public void addSticker(long stickerId)
- Specified by:
addSticker
in interfaceMessageBuilderBaseDelegate
-
addStickers
public void addStickers(java.util.Collection<java.lang.Long> stickerIds)
- Specified by:
addStickers
in interfaceMessageBuilderBaseDelegate
-
getStringBuilder
public java.lang.StringBuilder getStringBuilder()
- Specified by:
getStringBuilder
in interfaceMessageBuilderBaseDelegate
-
send
public java.util.concurrent.CompletableFuture<Message> send(User user)
- Specified by:
send
in interfaceMessageBuilderBaseDelegate
-
send
public java.util.concurrent.CompletableFuture<Message> send(Messageable messageable)
- Specified by:
send
in interfaceMessageBuilderBaseDelegate
-
send
public java.util.concurrent.CompletableFuture<Message> send(TextChannel channel)
- Specified by:
send
in interfaceMessageBuilderBaseDelegate
-
send
public java.util.concurrent.CompletableFuture<Message> send(IncomingWebhook webhook)
- Specified by:
send
in interfaceMessageBuilderBaseDelegate
-
send
protected java.util.concurrent.CompletableFuture<Message> send(java.lang.String webhookId, java.lang.String webhookToken, java.lang.String displayName, java.net.URL avatarUrl, boolean wait, DiscordApi api)
Send a message to an incoming webhook.- Parameters:
webhookId
- The id of the webhook to send the message towebhookToken
- The token of the webhook to send the message todisplayName
- The display name the webhook should useavatarUrl
- The avatar the webhook should usewait
- If the completable future will be completedapi
- The api instance needed to send and return the message- Returns:
- The sent message
-
sendWithWebhook
public java.util.concurrent.CompletableFuture<Message> sendWithWebhook(DiscordApi api, java.lang.String webhookId, java.lang.String webhookToken)
- Specified by:
sendWithWebhook
in interfaceMessageBuilderBaseDelegate
-
edit
public java.util.concurrent.CompletableFuture<Message> edit(Message message, boolean updateAll)
- Specified by:
edit
in interfaceMessageBuilderBaseDelegate
-
addMultipartBodyToRequest
protected void addMultipartBodyToRequest(RestRequest<?> request, com.fasterxml.jackson.databind.node.ObjectNode body, java.util.List<FileContainer> attachments, DiscordApi api)
Method which creates and adds a MultipartBody to a RestRequest.- Parameters:
request
- The RestRequest to add the MultipartBody tobody
- The body to use as base for the MultipartBodyattachments
- The List of FileContainers to add as attachmentsapi
- The api instance needed to add the attachments
-
prepareCommonWebhookMessageBodyParts
protected void prepareCommonWebhookMessageBodyParts(com.fasterxml.jackson.databind.node.ObjectNode body)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
prepareComponents
protected void prepareComponents(com.fasterxml.jackson.databind.node.ObjectNode body)
-
prepareComponents
protected void prepareComponents(com.fasterxml.jackson.databind.node.ObjectNode body, boolean evenIfEmpty)
-
-