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.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static MessageEditData
fromContent
(String content) Shortcut fornew MessageEditBuilder().setContent(content).build()
.static MessageEditData
Shortcut fornew MessageCreateBuilder().applyCreateData(data).build()
.static MessageEditData
fromEmbeds
(Collection<? extends MessageEmbed> embeds) Shortcut fornew MessageEditBuilder().setEmbeds(embeds).build()
.static MessageEditData
fromEmbeds
(MessageEmbed... embeds) Shortcut fornew MessageEditBuilder().setEmbeds(embeds).build()
.static MessageEditData
fromFiles
(Collection<? extends FileUpload> files) Shortcut fornew MessageEditBuilder().setFiles(embeds).build()
.static MessageEditData
fromFiles
(FileUpload... files) Shortcut fornew MessageEditBuilder().setFiles(embeds).build()
.static MessageEditData
fromMessage
(Message message) Shortcut fornew MessageEditBuilder().applyMessage(message).build()
.The mention types which are whitelisted.TheAttachedFiles
attached to this message.The components of the message.The content of the message.The embeds of the message.getFiles()
TheFileUploads
attached 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.boolean
Whether this message would mention a user, if it is sent as a reply.boolean
Whether embeds will be suppressed on this message.toData()
SerializedDataObject
for 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:
getContent
in interfaceMessageData
- Returns:
- The content or an empty string if none was set
- See Also:
-
getEmbeds
The embeds of the message.- Specified by:
getEmbeds
in interfaceMessageData
- Returns:
- The embeds or an empty list if none were set
- See Also:
-
getComponents
The components of the message.- Specified by:
getComponents
in interfaceMessageData
- Returns:
- The components or an empty list if none were set
- See Also:
-
getAttachments
TheAttachedFiles
attached to this message.- Specified by:
getAttachments
in interfaceMessageData
- Returns:
- The list of attachments, or an empty list if none were set
- See Also:
-
isSuppressEmbeds
public boolean isSuppressEmbeds()Description copied from interface:MessageData
Whether embeds will be suppressed on this message.- Specified by:
isSuppressEmbeds
in interfaceMessageData
- Returns:
- True, if embeds are suppressed
-
getMentionedUsers
The IDs for users which are allowed to be mentioned, or an empty list.- Specified by:
getMentionedUsers
in 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:
getMentionedRoles
in interfaceMessageData
- Returns:
- The role IDs which are mention whitelisted
-
getAllowedMentions
The mention types which are whitelisted.- Specified by:
getAllowedMentions
in 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:
isMentionRepliedUser
in interfaceMessageData
- Returns:
- True, if this would mention with the reply
-
toData
Description copied from interface:SerializableData
SerializedDataObject
for this object.- Specified by:
toData
in interfaceSerializableData
- Returns:
DataObject
-
getFiles
TheFileUploads
attached to this message.- Returns:
- The list of file uploads
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-