Class MessageEditData
java.lang.Object
net.dv8tion.jda.api.utils.messages.MessageEditData
- All Implemented Interfaces:
AutoCloseable,SerializableData,MessageData
Output of a
MessageEditRequest and used for editing messages in channels/webhooks/interactions.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static MessageEditDatafromContent(String content) Shortcut fornew MessageEditBuilder().setContent(content).build().static MessageEditDataShortcut fornew MessageCreateBuilder().applyCreateData(data).build().static MessageEditDatafromEmbeds(Collection<? extends MessageEmbed> embeds) Shortcut fornew MessageEditBuilder().setEmbeds(embeds).build().static MessageEditDatafromEmbeds(MessageEmbed... embeds) Shortcut fornew MessageEditBuilder().setEmbeds(embeds).build().static MessageEditDatafromFiles(Collection<? extends FileUpload> files) Shortcut fornew MessageEditBuilder().setFiles(embeds).build().static MessageEditDatafromFiles(FileUpload... files) Shortcut fornew MessageEditBuilder().setFiles(embeds).build().static MessageEditDatafromMessage(Message message) Shortcut fornew MessageEditBuilder().applyMessage(message).build().The mention types which are whitelisted.TheAttachedFilesattached to this message.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.booleanWhether this message would mention a user, if it is sent as a reply.booleanWhether embeds will be suppressed on this message.toData()SerializedDataObjectfor this object.
-
Method Details
-
fromContent
Shortcut fornew MessageEditBuilder().setContent(content).build().- Parameters:
content- The message content (up to 2000)- Returns:
- New valid instance of MessageEditData
- Throws:
IllegalArgumentException- If the content is null, empty, or longer than 2000- See Also:
-
fromEmbeds
@Nonnull public static MessageEditData fromEmbeds(@Nonnull Collection<? extends MessageEmbed> embeds) Shortcut fornew MessageEditBuilder().setEmbeds(embeds).build().- Parameters:
embeds- The message embeds (up to 10)- Returns:
- New valid instance of MessageEditData
- Throws:
IllegalArgumentException- If the embed list is null, empty, or longer than 10- See Also:
-
fromEmbeds
Shortcut fornew MessageEditBuilder().setEmbeds(embeds).build().- Parameters:
embeds- The message embeds (up to 10)- Returns:
- New valid instance of MessageEditData
- Throws:
IllegalArgumentException- If the embed list is null, empty, or longer than 10- See Also:
-
fromFiles
Shortcut fornew MessageEditBuilder().setFiles(embeds).build().- Parameters:
files- The file uploads- Returns:
- New valid instance of MessageEditData
- Throws:
IllegalArgumentException- If the null is provided or the list is empty- See Also:
-
fromFiles
Shortcut fornew MessageEditBuilder().setFiles(embeds).build().- Parameters:
files- The file uploads- Returns:
- New valid instance of MessageEditData
- Throws:
IllegalArgumentException- If the null is provided or the list is empty- See Also:
-
fromMessage
Shortcut fornew MessageEditBuilder().applyMessage(message).build().- Parameters:
message- The message to apply- Returns:
- New valid instance of MessageEditData
- Throws:
IllegalArgumentException- If the message is null or a system message- See Also:
-
fromCreateData
Shortcut fornew MessageCreateBuilder().applyCreateData(data).build().- Parameters:
data- The message create data to apply- Returns:
- New valid instance of MessageEditData
- Throws:
IllegalArgumentException- If the data is null or empty- See Also:
-
getContent
The content of the message.- Specified by:
getContentin interfaceMessageData- Returns:
- The content or an empty string if none was set
- See Also:
-
getEmbeds
The embeds of the message.- Specified by:
getEmbedsin interfaceMessageData- Returns:
- The embeds or an empty list if none were set
- See Also:
-
getComponents
The components of the message.- Specified by:
getComponentsin interfaceMessageData- Returns:
- The components or an empty list if none were set
- See Also:
-
getAttachments
TheAttachedFilesattached to this message.- Specified by:
getAttachmentsin interfaceMessageData- Returns:
- The list of attachments, or an empty list if none were set
- See Also:
-
isSuppressEmbeds
public boolean isSuppressEmbeds()Description copied from interface:MessageDataWhether embeds will be suppressed on this message.- Specified by:
isSuppressEmbedsin interfaceMessageData- Returns:
- True, if embeds are suppressed
-
getMentionedUsers
The IDs for users which are allowed to be mentioned, or an empty list.- Specified by:
getMentionedUsersin interfaceMessageData- Returns:
- The user IDs which are mention whitelisted
-
getMentionedRoles
The IDs for roles which are allowed to be mentioned, or an empty list.- Specified by:
getMentionedRolesin interfaceMessageData- Returns:
- The role IDs which are mention whitelisted
-
getAllowedMentions
The mention types which are whitelisted.- Specified by:
getAllowedMentionsin interfaceMessageData- Returns:
- The mention types which can be mentioned by this message
-
isMentionRepliedUser
public boolean isMentionRepliedUser()Whether this message would mention a user, if it is sent as a reply.- Specified by:
isMentionRepliedUserin interfaceMessageData- Returns:
- True, if this would mention with the reply
-
toData
Description copied from interface:SerializableDataSerializedDataObjectfor this object.- Specified by:
toDatain interfaceSerializableData- Returns:
DataObject
-
getFiles
TheFileUploadsattached to this message.- Returns:
- The list of file uploads
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-