Class MessageCreateData
java.lang.Object
net.dv8tion.jda.api.utils.messages.MessageCreateData
- All Implemented Interfaces:
- AutoCloseable,- SerializableData,- MessageData
public class MessageCreateData
extends Object
implements MessageData, AutoCloseable, SerializableData
Output of a 
MessageCreateBuilder and used for sending messages to channels/webhooks/interactions.- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()static MessageCreateDatafromContent(String content) Shortcut fornew MessageCreateBuilder().setContent(content).build().static MessageCreateDatafromEditData(MessageEditData data) Shortcut fornew MessageCreateBuilder().applyEditData(data).build().static MessageCreateDatafromEmbeds(Collection<? extends MessageEmbed> embeds) Shortcut fornew MessageCreateBuilder().setEmbeds(embeds).build().static MessageCreateDatafromEmbeds(MessageEmbed... embeds) Shortcut fornew MessageCreateBuilder().setEmbeds(embeds).build().static MessageCreateDatafromFiles(Collection<? extends FileUpload> files) Shortcut fornew MessageCreateBuilder().setFiles(embeds).build().static MessageCreateDatafromFiles(FileUpload... files) Shortcut fornew MessageCreateBuilder().setFiles(embeds).build().static MessageCreateDatafromMessage(Message message) Shortcut fornew MessageCreateBuilder().applyMessage(message).build().The mention types which are whitelisted.List<? extends FileUpload>The configured message attachments asAttachedFile, this is the opposite ofMessageRequest.setFiles(Collection)and only returns what was set using that setter.The components of the message.The content of the message.The embeds of the message.getFiles()TheFileUploadsattached to this message.The IDs for roles which are allowed to be mentioned, or an empty list.The IDs for users which are allowed to be mentioned, or an empty list.getPoll()The poll to send with the messagebooleanWhether this message would mention a user, if it is sent as a reply.booleanWhether this message is silent.booleanWhether embeds will be suppressed on this message.booleanisTTS()Whether this message uses Text-to-Speech (TTS).booleanWhether this message is intended as a voice message.toData()SerializedDataObjectfor this object.
- 
Method Details- 
fromContentShortcut fornew MessageCreateBuilder().setContent(content).build().- Parameters:
- content- The message content (up to 2000)
- Returns:
- New valid instance of MessageCreateData
- Throws:
- IllegalArgumentException- If the content is null, empty, or longer than 2000
- See Also:
 
- 
fromEmbeds@Nonnull public static MessageCreateData fromEmbeds(@Nonnull Collection<? extends MessageEmbed> embeds) Shortcut fornew MessageCreateBuilder().setEmbeds(embeds).build().- Parameters:
- embeds- The message embeds (up to 10)
- Returns:
- New valid instance of MessageCreateData
- Throws:
- IllegalArgumentException- If the embed list is null, empty, or longer than 10
- See Also:
 
- 
fromEmbedsShortcut fornew MessageCreateBuilder().setEmbeds(embeds).build().- Parameters:
- embeds- The message embeds (up to 10)
- Returns:
- New valid instance of MessageCreateData
- Throws:
- IllegalArgumentException- If the embed list is null, empty, or longer than 10
- See Also:
 
- 
fromFilesShortcut fornew MessageCreateBuilder().setFiles(embeds).build().- Parameters:
- files- The file uploads
- Returns:
- New valid instance of MessageCreateData
- Throws:
- IllegalArgumentException- If the null is provided or the list is empty
- See Also:
 
- 
fromFilesShortcut fornew MessageCreateBuilder().setFiles(embeds).build().- Parameters:
- files- The file uploads
- Returns:
- New valid instance of MessageCreateData
- Throws:
- IllegalArgumentException- If the null is provided or the list is empty
- See Also:
 
- 
fromMessageShortcut fornew MessageCreateBuilder().applyMessage(message).build().- Parameters:
- message- The message to apply
- Returns:
- New valid instance of MessageCreateData
- Throws:
- IllegalArgumentException- If the message is null or a system message
- See Also:
 
- 
fromEditDataShortcut fornew MessageCreateBuilder().applyEditData(data).build().- Parameters:
- data- The message edit data to apply
- Returns:
- New valid instance of MessageCreateData
- Throws:
- IllegalArgumentException- If the data is null or empty
- See Also:
 
- 
getContentThe content of the message.- Specified by:
- getContentin interface- MessageData
- Returns:
- The content or an empty string if none was provided
- See Also:
 
- 
getEmbedsThe embeds of the message.- Specified by:
- getEmbedsin interface- MessageData
- Returns:
- The embeds or an empty list if none were provided
- See Also:
 
- 
getComponentsThe components of the message.- Specified by:
- getComponentsin interface- MessageData
- Returns:
- The components or an empty list if none were provided
- See Also:
 
- 
getAttachmentsDescription copied from interface:MessageDataThe configured message attachments asAttachedFile, this is the opposite ofMessageRequest.setFiles(Collection)and only returns what was set using that setter.For message edit requests, this will not be the current file attachments of the message. - Specified by:
- getAttachmentsin interface- MessageData
- Returns:
- The currently configured attachments, or an empty list if none were set yet
- See Also:
 
- 
getPollThe poll to send with the message- Returns:
- The poll, or null if no poll is sent
 
- 
isSuppressEmbedspublic boolean isSuppressEmbeds()Description copied from interface:MessageDataWhether embeds will be suppressed on this message.- Specified by:
- isSuppressEmbedsin interface- MessageData
- Returns:
- True, if embeds are suppressed
 
- 
isTTSpublic boolean isTTS()Whether this message uses Text-to-Speech (TTS).- Returns:
- True, if text to speech will be used when this is sent
 
- 
isSuppressedNotificationspublic boolean isSuppressedNotifications()Whether this message is silent.- Returns:
- True, if the message will not trigger push and desktop notifications.
 
- 
isVoiceMessagepublic boolean isVoiceMessage()Whether this message is intended as a voice message.- Returns:
- True, if this message is intended as a voice message.
 
- 
getMentionedUsersThe IDs for users which are allowed to be mentioned, or an empty list.- Specified by:
- getMentionedUsersin interface- MessageData
- Returns:
- The user IDs which are mention whitelisted
 
- 
getMentionedRolesThe IDs for roles which are allowed to be mentioned, or an empty list.- Specified by:
- getMentionedRolesin interface- MessageData
- Returns:
- The role IDs which are mention whitelisted
 
- 
getAllowedMentionsThe mention types which are whitelisted.- Specified by:
- getAllowedMentionsin interface- MessageData
- Returns:
- The mention types which can be mentioned by this message
 
- 
isMentionRepliedUserpublic boolean isMentionRepliedUser()Whether this message would mention a user, if it is sent as a reply.- Specified by:
- isMentionRepliedUserin interface- MessageData
- Returns:
- True, if this would mention with the reply
 
- 
toDataDescription copied from interface:SerializableDataSerializedDataObjectfor this object.- Specified by:
- toDatain interface- SerializableData
- Returns:
- DataObject
 
- 
getFilesTheFileUploadsattached to this message.- Returns:
- The list of file uploads
 
- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
 
 
-