Interface MessageBuilderDelegate
-
- All Known Subinterfaces:
WebhookMessageBuilderDelegate
public interface MessageBuilderDelegateThis class is internally used by theMessageBuilderto create messages. You usually don't want to interact with this object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddAttachment(byte[] bytes, String fileName)Adds an attachment to the message.voidaddAttachment(BufferedImage image, String fileName)Adds an attachment to the message.voidaddAttachment(File file)Adds an attachment to the message.voidaddAttachment(InputStream stream, String fileName)Adds an attachment to the message.voidaddAttachment(URL url)Adds an attachment to the message.voidaddAttachment(Icon icon)Adds an attachment to the message.voidaddAttachmentAsSpoiler(File file)Adds a spoiler attachment to the message.voidaddAttachmentAsSpoiler(URL url)Adds a spoiler attachment to the message.voidaddAttachmentAsSpoiler(Icon icon)Adds a spoiler attachment to the message.voidaddEmbed(EmbedBuilder embed)Adds the embed to the message.voidaddFile(byte[] bytes, String fileName)Adds a file to the message.voidaddFile(BufferedImage image, String fileName)Adds a file to the message.voidaddFile(File file)Adds a file to the message.voidaddFile(InputStream stream, String fileName)Adds a file to the message.voidaddFile(URL url)Adds a file to the message.voidaddFile(Icon icon)Adds a file to the message.voidaddFileAsSpoiler(File file)Adds a spoiler attachment to the message.voidaddFileAsSpoiler(URL url)Adds a spoiler attachment to the message.voidaddFileAsSpoiler(Icon icon)Adds a spoiler attachment to the message.voidappend(Object object)Appends the string representation of the object (callingString.valueOf(Object)method) to the message.voidappend(String message, MessageDecoration... decorations)Appends a sting with or without decoration to the message.voidappend(Mentionable entity)Appends a mentionable entity (usually a user or channel) to the message.voidappendCode(String language, String code)Appends code to the message.voidappendNewLine()Appends a new line to the message.StringBuildergetStringBuilder()Gets theStringBuilderwhich is used to build the message.voidremoveAllEmbeds()Removes all embeds from the message.voidreplyTo(long messageId)Sets the message to reply to.CompletableFuture<Message>send(TextChannel channel)Sends the message.CompletableFuture<Message>send(Messageable messageable)Sends the message.CompletableFuture<Message>send(User user)Sends the message.CompletableFuture<Message>send(IncomingWebhook webhook)Sends the message.CompletableFuture<Message>sendWithWebhook(DiscordApi api, String webhookId, String webhookToken)Sends the message.voidsetAllowedMentions(AllowedMentions allowedMentions)Controls the mention behavior.voidsetContent(String content)Sets the content of the message.voidsetNonce(String nonce)Sets the nonce of the message.voidsetTts(boolean tts)Sets if the message should be text to speech.
-
-
-
Method Detail
-
appendCode
void appendCode(String language, String code)
Appends code to the message.- Parameters:
language- The language, e.g. "java".code- The code.
-
append
void append(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.
-
append
void append(Mentionable entity)
Appends a mentionable entity (usually a user or channel) to the message.- Parameters:
entity- The entity to mention.
-
append
void append(Object object)
Appends the string representation of the object (callingString.valueOf(Object)method) to the message.- Parameters:
object- The object to append.- See Also:
StringBuilder.append(Object)
-
appendNewLine
void appendNewLine()
Appends a new line to the message.
-
setContent
void setContent(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.
-
addEmbed
void addEmbed(EmbedBuilder embed)
Adds the embed to the message.- Parameters:
embed- The embed to add.
-
removeAllEmbeds
void removeAllEmbeds()
Removes all embeds from the message.
-
setTts
void setTts(boolean tts)
Sets if the message should be text to speech.- Parameters:
tts- Whether the message should be text to speech or not.
-
addFile
void addFile(BufferedImage image, String fileName)
Adds a file to the message.- Parameters:
image- The image to add as an attachment.fileName- The file name of the image.- See Also:
addAttachment(BufferedImage, String)
-
addFile
void addFile(File file)
Adds a file to the message.- Parameters:
file- The file to add as an attachment.- See Also:
addAttachment(File)
-
addFile
void addFile(Icon icon)
Adds a file to the message.- Parameters:
icon- The icon to add as an attachment.- See Also:
addAttachment(Icon)
-
addFile
void addFile(URL url)
Adds a file to the message.- Parameters:
url- The url of the attachment.- See Also:
addAttachment(URL)
-
addFile
void addFile(byte[] bytes, String fileName)Adds a file to the message.- Parameters:
bytes- The bytes of the file.fileName- The name of the file.- See Also:
addAttachment(byte[], String)
-
addFile
void addFile(InputStream stream, String fileName)
Adds a file to the message.- Parameters:
stream- The stream of the file.fileName- The name of the file.- See Also:
addAttachment(InputStream, String)
-
addFileAsSpoiler
void addFileAsSpoiler(File file)
Adds a spoiler attachment to the message.- Parameters:
file- The file to add as an attachment.
-
addFileAsSpoiler
void addFileAsSpoiler(Icon icon)
Adds a spoiler attachment to the message.- Parameters:
icon- The icon to add as an attachment.
-
addFileAsSpoiler
void addFileAsSpoiler(URL url)
Adds a spoiler attachment to the message.- Parameters:
url- The url of the attachment.
-
addAttachment
void addAttachment(BufferedImage image, String fileName)
Adds an attachment to the message.- Parameters:
image- The image to add as an attachment.fileName- The file name of the image.
-
addAttachment
void addAttachment(File file)
Adds an attachment to the message.- Parameters:
file- The file to add as an attachment.
-
addAttachment
void addAttachment(Icon icon)
Adds an attachment to the message.- Parameters:
icon- The icon to add as an attachment.
-
addAttachment
void addAttachment(URL url)
Adds an attachment to the message.- Parameters:
url- The url of the attachment.
-
addAttachment
void addAttachment(byte[] bytes, String fileName)Adds an attachment to the message.- Parameters:
bytes- The bytes of the file.fileName- The name of the file.
-
addAttachment
void addAttachment(InputStream stream, String fileName)
Adds an attachment to the message.- Parameters:
stream- The stream of the file.fileName- The name of the file.
-
addAttachmentAsSpoiler
void addAttachmentAsSpoiler(File file)
Adds a spoiler attachment to the message.- Parameters:
file- The file to add as an attachment.
-
addAttachmentAsSpoiler
void addAttachmentAsSpoiler(Icon icon)
Adds a spoiler attachment to the message.- Parameters:
icon- The icon to add as an attachment.
-
addAttachmentAsSpoiler
void addAttachmentAsSpoiler(URL url)
Adds a spoiler attachment to the message.- Parameters:
url- The url of the attachment.
-
setAllowedMentions
void setAllowedMentions(AllowedMentions allowedMentions)
Controls the mention behavior.- Parameters:
allowedMentions- The mention object to specify which mention should ping.
-
replyTo
void replyTo(long messageId)
Sets the message to reply to.- Parameters:
messageId- The id of the message to reply to.
-
setNonce
void setNonce(String nonce)
Sets the nonce of the message.- Parameters:
nonce- The nonce to set.
-
getStringBuilder
StringBuilder getStringBuilder()
Gets theStringBuilderwhich is used to build the message.- Returns:
- The StringBuilder which is used to build the message.
-
send
CompletableFuture<Message> send(User user)
Sends the message.- Parameters:
user- The user to which the message should be sent.- Returns:
- The sent message.
-
send
CompletableFuture<Message> send(TextChannel channel)
Sends the message.- Parameters:
channel- The channel in which the message should be sent.- Returns:
- The sent message.
-
send
CompletableFuture<Message> send(IncomingWebhook webhook)
Sends the message.- Parameters:
webhook- The webhook from which the message should be sent.- Returns:
- The sent message.
-
send
CompletableFuture<Message> send(Messageable messageable)
Sends the message.- Parameters:
messageable- The receiver of the message.- Returns:
- The sent message.
-
sendWithWebhook
CompletableFuture<Message> sendWithWebhook(DiscordApi api, String webhookId, String webhookToken)
Sends the message.- Parameters:
api- The api instance needed to send and return the message.webhookId- The id of the webhook from which the message should be sent.webhookToken- The token of the webhook from which the message should be sent.- Returns:
- The sent message.
-
-