Interface MessageAction
- All Superinterfaces:
AllowedMentions<MessageAction>
,Appendable
,RestAction<Message>
RestAction
that allows setting message information before sending!
This is available as return type of all sendMessage/sendFile methods in MessageChannel
.
When updating a Message, unset fields will be ignored by default. To override existing fields with no value (remove content)
you can use override(true)
. Setting this to true
will cause all fields to be considered
and will override the Message entirely causing unset values to be removed from that message.
This can be used to remove existing embeds from a message:
message.editMessage("This message had an embed").override(true).queue()
When this RestAction has been executed all provided files will be closed.
If you decide not to execute this action, you should call clearFiles()
to free resources.
Note that the garbage collector also frees opened file streams when it finalizes the stream object.
Example
@Override
public void onMessageReceived(MessageReceivedEvent event)
{
MessageChannel channel = event.getChannel();
channel.sendMessage("This has an embed with an image!")
.addFile(new File("dog.png"))
.setEmbeds(new EmbedBuilder()
.setImage("attachment://dog.png")
.build())
.queue(); // this actually sends the information to discord
}
- Since:
- 3.4.0
- See Also:
-
Message.editMessage(Message)
Message.editMessage(CharSequence)
Message.editMessageEmbeds(MessageEmbed...)
Message.editMessageFormat(String, Object...)
MessageChannel.sendMessage(Message)
MessageChannel.sendMessage(CharSequence)
MessageChannel.sendMessageEmbeds(MessageEmbed, MessageEmbed...)
MessageChannel.sendMessageFormat(String, Object...)
MessageChannel.sendFile(File, AttachmentOption...)
MessageChannel.sendFile(File, String, AttachmentOption...)
MessageChannel.sendFile(InputStream, String, AttachmentOption...)
MessageChannel.sendFile(byte[], String, AttachmentOption...)
-
Method Summary
Modifier and TypeMethodDescriptiondefault MessageAction
addFile
(byte[] data, String name, AttachmentOption... options) Adds the provided byte[] as file data.addFile
(File file, String name, AttachmentOption... options) Adds the providedFile
as file data.default MessageAction
addFile
(File file, AttachmentOption... options) Adds the providedFile
as file data.addFile
(InputStream data, String name, AttachmentOption... options) Adds the providedInputStream
as file data.append
(char c) default MessageAction
append
(CharSequence csq) append
(CharSequence csq, int start, int end) default MessageAction
appendFormat
(String format, Object... args) Applies the result ofString.format(String, Object...)
as content.Applies the sendable information of the providedMessage
to this MessageAction settings.Clears all previously added files
And closesFileInputStreams
generated byaddFile(File, String, net.dv8tion.jda.api.utils.AttachmentOption...)
.clearFiles
(BiConsumer<String, InputStream> finalizer) Clears all previously added filesclearFiles
(Consumer<InputStream> finalizer) Clears all previously added files
TheclearFiles(BiConsumer)
version provides the resource name for more selective operations.Overrides existing content with the provided input
The content of a Message may not exceed 2000!deadline
(long timestamp) Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.failOnInvalidReply
(boolean fail) Whether to throw a exception if the referenced message does not exist, when replying to a message.The targetMessageChannel
for this messagestatic EnumSet<Message.MentionType>
Returns the defaultMentionTypes
previously set byMessageAction.setDefaultMentions(Collection)
.static boolean
Returns the default behavior for replies when the referenced message does not exist.static boolean
Returns the default mention behavior for replies.boolean
isEdit()
Whether this MessageAction will be used to update an existing message.boolean
isEmpty()
Whether this MessageAction has no values set.mentionRepliedUser
(boolean mention) Whether to mention the user when replying to a message.Sets the validation nonce for the outgoing Messageoverride
(boolean bool) Whether all fields should be considered when editing a messagedefault MessageAction
Make the message a reply to the referenced message.referenceById
(long messageId) Make the message a reply to the referenced message.default MessageAction
referenceById
(String messageId) Make the message a reply to the referenced message.reset()
Resets this MessageAction to empty stateisEmpty()
will result intrue
after this has been performed!default MessageAction
retainFiles
(Collection<? extends Message.Attachment> attachments) Removes all attachments that are currently attached to the existing message except for the ones provided.default MessageAction
retainFilesById
(long... ids) Removes all attachments that are currently attached to the existing message except for the ones provided.default MessageAction
retainFilesById
(String... ids) Removes all attachments that are currently attached to the existing message except for the ones provided.retainFilesById
(Collection<String> ids) Removes all attachments that are currently attached to the existing message except for the ones provided.default MessageAction
setActionRow
(Collection<? extends ItemComponent> components) Create one row of up to 5 messagecomponents
.default MessageAction
setActionRow
(ItemComponent... components) Create one row of up to 5 messagecomponents
.default MessageAction
setActionRows
(Collection<? extends ActionRow> rows) Set the action rows for the message.setActionRows
(ActionRow... rows) Set the action rows for the message.setCheck
(BooleanSupplier checks) Sets the last-second checks before finally executing the http request in the queue.static void
setDefaultFailOnInvalidReply
(boolean fail) Sets the default value forfailOnInvalidReply(boolean)
static void
setDefaultMentionRepliedUser
(boolean mention) Sets the default value formentionRepliedUser(boolean)
static void
setDefaultMentions
(Collection<Message.MentionType> allowedMentions) Sets theMentionTypes
that should be parsed by default.setEmbeds
(Collection<? extends MessageEmbed> embeds) Sets up to 10MessageEmbeds
that should be used for this Message.default MessageAction
setEmbeds
(MessageEmbed... embeds) Sets up to 10MessageEmbeds
that should be used for this Message.Timeout for this RestAction instance.tts
(boolean isTTS) Enable/Disable Text-To-Speech for the resulting message.Methods inherited from interface net.dv8tion.jda.api.utils.AllowedMentions
allowedMentions, mention, mention, mentionRoles, mentionRoles, mentionUsers, mentionUsers
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Method Details
-
setDefaultMentions
Sets theMentionTypes
that should be parsed by default. This just sets the default for all MessageActions and can be overridden on a per-action basis usingAllowedMentions.allowedMentions(Collection)
.
If a message is sent with an empty Set of MentionTypes, then it will not ping any User, Role or@everyone
/@here
, while still showing up as mention tag.If
null
is provided to this method, then all Types will be pingable (unless whitelisting via one of themention*
methods is used).Example
// Disable EVERYONE and HERE mentions by default (to avoid mass ping) EnumSet<Message.MentionType> deny = EnumSet.of(Message.MentionType.EVERYONE, Message.MentionType.HERE); MessageAction.setDefaultMentions(EnumSet.complementOf(deny));
- Parameters:
allowedMentions
- MentionTypes that are allowed to being parsed and pinged.null
to disable and allow all mentions.
-
getDefaultMentions
Returns the defaultMentionTypes
previously set byMessageAction.setDefaultMentions(Collection)
.- Returns:
- Default mentions set by MessageAction.setDefaultMentions(Collection)
-
setDefaultMentionRepliedUser
static void setDefaultMentionRepliedUser(boolean mention) Sets the default value formentionRepliedUser(boolean)
Default: true
- Parameters:
mention
- True, if replies should mention by default
-
isDefaultMentionRepliedUser
static boolean isDefaultMentionRepliedUser()Returns the default mention behavior for replies.
If this istrue
then all replies will mention the author of the target message by default. You can specify this individually withmentionRepliedUser(boolean)
for each message.Default: true
- Returns:
- True, if replies mention by default
-
setDefaultFailOnInvalidReply
static void setDefaultFailOnInvalidReply(boolean fail) Sets the default value forfailOnInvalidReply(boolean)
Default: false
- Parameters:
fail
- True, to throw a exception if the referenced message does not exist
-
isDefaultFailOnInvalidReply
static boolean isDefaultFailOnInvalidReply()Returns the default behavior for replies when the referenced message does not exist.
If this istrue
then all replies will throw an exception if the referenced message does not exist. You can specify this individually withfailOnInvalidReply(boolean)
for each message.Default: false
- Returns:
- True, to throw a exception if the referenced message does not exist
-
setCheck
Description copied from interface:RestAction
Sets the last-second checks before finally executing the http request in the queue.
If the provided supplier evaluates tofalse
or throws an exception this will not be finished. When an exception is thrown from the supplier it will be provided to the failure callback.- Specified by:
setCheck
in interfaceRestAction<Message>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
- See Also:
-
timeout
Description copied from interface:RestAction
Timeout for this RestAction instance.
If the request doesn't get executed within the timeout it will fail.When a RestAction times out, it will fail with a
TimeoutException
. This is the same asdeadline(System.currentTimeMillis() + unit.toMillis(timeout))
.Example
action.timeout(10, TimeUnit.SECONDS) // 10 seconds from now .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
- Specified by:
timeout
in interfaceRestAction<Message>
- Parameters:
timeout
- The timeout to useunit
-Unit
for the timeout value- Returns:
- The same RestAction instance with the applied timeout
- See Also:
-
deadline
Description copied from interface:RestAction
Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.
If the deadline is reached, the request will fail with aTimeoutException
.This does not mean that the request will immediately timeout when the deadline is reached. JDA will check the deadline right before executing the request or within intervals in a worker thread. This only means the request will timeout if the deadline has passed.
Example
action.deadline(System.currentTimeMillis() + 10000) // 10 seconds from now .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
- Specified by:
deadline
in interfaceRestAction<Message>
- Parameters:
timestamp
- Millisecond timestamp at which the request will timeout- Returns:
- The same RestAction with the applied deadline
- See Also:
-
getChannel
The targetMessageChannel
for this message- Returns:
- The target channel
-
isEmpty
boolean isEmpty()Whether this MessageAction has no values set.
Trying to execute withisEmpty() == true
will result in anIllegalStateException
!This does not check for files!
- Returns:
- True, if no settings have been applied
-
isEdit
boolean isEdit()Whether this MessageAction will be used to update an existing message.- Returns:
- True, if this MessageAction targets an existing message
-
apply
Applies the sendable information of the providedMessage
to this MessageAction settings.
This will override all existing settings if new settings are available.This does not copy files!
- Parameters:
message
- The nullable Message to apply settings from- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the message contains aMessageEmbed
that exceeds the sendable character limit, seeMessageEmbed.isSendable()
-
referenceById
Make the message a reply to the referenced message.
You can only reply to messages from the same channel!
This will mention the author of the target message. You can disable this throughmentionRepliedUser(boolean)
.
By default there won't be any error thrown if the referenced message does not exist. This behavior can be changed withfailOnInvalidReply(boolean)
.This requires
Permission.MESSAGE_HISTORY
in the channel! You cannot reply to system messages such asCHANNEL_PINNED_ADD
and similar.- Parameters:
messageId
- The target message- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the provided ID is null or not a valid snowflakeUnsupportedOperationException
- If the provided message is from aMessageBuilder
- Since:
- 4.2.1
-
referenceById
Make the message a reply to the referenced message.
You can only reply to messages from the same channel!
This will mention the author of the target message. You can disable this throughmentionRepliedUser(boolean)
.
By default there won't be any error thrown if the referenced message does not exist. This behavior can be changed withfailOnInvalidReply(boolean)
.This requires
Permission.MESSAGE_HISTORY
in the channel! You cannot reply to system messages such asCHANNEL_PINNED_ADD
and similar.- Parameters:
messageId
- The target message- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the provided ID is null or not a valid snowflakeUnsupportedOperationException
- If the provided message is from aMessageBuilder
- Since:
- 4.2.1
-
reference
Make the message a reply to the referenced message.
You can only reply to messages from the same channel!
This will mention the author of the target message. You can disable this throughmentionRepliedUser(boolean)
.
By default there won't be any error thrown if the referenced message does not exist. This behavior can be changed withfailOnInvalidReply(boolean)
.This requires
Permission.MESSAGE_HISTORY
in the channel! You cannot reply to system messages such asCHANNEL_PINNED_ADD
and similar.- Parameters:
message
- The target message- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the provided message is nullUnsupportedOperationException
- If the provided message is from aMessageBuilder
- Since:
- 4.2.1
-
mentionRepliedUser
Whether to mention the user when replying to a message.
This only matters in combination withreference(Message)
andreferenceById(long)
!This is true by default but can be configured using
setDefaultMentionRepliedUser(boolean)
!- Specified by:
mentionRepliedUser
in interfaceAllowedMentions<MessageAction>
- Parameters:
mention
- True, to mention the author if the referenced message- Returns:
- Updated MessageAction for chaining convenience
- Since:
- 4.2.1
-
failOnInvalidReply
Whether to throw a exception if the referenced message does not exist, when replying to a message.
This only matters in combination withreference(Message)
andreferenceById(long)
!This is false by default but can be configured using
setDefaultFailOnInvalidReply(boolean)
!- Parameters:
fail
- True, to throw a exception if the referenced message does not exist- Returns:
- Updated MessageAction for chaining convenience
- Since:
- 4.2.1
-
tts
Enable/Disable Text-To-Speech for the resulting message.
This is only relevant to MessageActions that are notisEdit() == true
!- Parameters:
isTTS
- True, if this should cause a Text-To-Speech effect when sent to the channel- Returns:
- Updated MessageAction for chaining convenience
-
reset
Resets this MessageAction to empty stateisEmpty()
will result intrue
after this has been performed!Convenience over using
content(null).nonce(null).setEmbeds(emptyList()).tts(false).override(false).clearFiles()
- Returns:
- Updated MessageAction for chaining convenience
-
nonce
Sets the validation nonce for the outgoing MessageFor more information see
MessageBuilder.setNonce(String)
andMessage.getNonce()
- Parameters:
nonce
- The nonce that shall be used- Returns:
- Updated MessageAction for chaining convenience
- See Also:
-
content
Overrides existing content with the provided input
The content of a Message may not exceed 2000!- Parameters:
content
- Sets the specified content and overrides previous content ornull
to reset content- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the provided content exceeds the 2000 character limit
-
setEmbeds
@Nonnull @CheckReturnValue MessageAction setEmbeds(@Nonnull Collection<? extends MessageEmbed> embeds) Sets up to 10MessageEmbeds
that should be used for this Message. Refer toEmbedBuilder
for more information.- Parameters:
embeds
- TheMessageEmbeds
that should be attached to this message,Collections.emptyList()
to use no embed.- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If any of the provided MessageEmbeds is not sendable according toMessageEmbed.isSendable()
! If the provided MessageEmbed is an unknown implementation this operation will fail as we are unable to deserialize it.
-
setEmbeds
Sets up to 10MessageEmbeds
that should be used for this Message. Refer toEmbedBuilder
for more information.- Parameters:
embeds
- TheMessageEmbeds
that should be attached to this message,Collections.emptyList()
to use no embed.- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If any of the provided MessageEmbeds is not sendable according toMessageEmbed.isSendable()
! If the provided MessageEmbed is an unknown implementation this operation will fail as we are unable to deserialize it.
-
append
- Specified by:
append
in interfaceAppendable
- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the appended CharSequence is too big and will cause the content to exceed the 2000 character limit
-
append
- Specified by:
append
in interfaceAppendable
- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the appended CharSequence is too big and will cause the content to exceed the 2000 character limit
-
append
- Specified by:
append
in interfaceAppendable
- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the appended CharSequence is too big and will cause the content to exceed the 2000 character limit
-
appendFormat
@Nonnull @CheckReturnValue default MessageAction appendFormat(@Nonnull String format, Object... args) Applies the result ofString.format(String, Object...)
as content.For more information of formatting review the
Formatter
documentation!- Parameters:
format
- The format Stringargs
- The arguments that should be used for conversion- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If the appended formatting is too big and will cause the content to exceed the 2000 character limitIllegalFormatException
- If a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions. For specification of all possible formatting errors, see the Details section of the formatter class specification.
-
addFile
@Nonnull @CheckReturnValue MessageAction addFile(@Nonnull InputStream data, @Nonnull String name, @Nonnull AttachmentOption... options) Adds the providedInputStream
as file data.
The stream will be closed upon execution!To reset all files use
clearFiles()
- Parameters:
data
- The InputStream that will be interpreted as file dataname
- The file name that should be used to interpret the type of the given data using the file-name extension. This name is similar to what will be visible throughMessage.Attachment.getFileName()
options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalStateException
- If the file limit of 10 has been reached prior to calling this methodIllegalArgumentException
- If the provided data isnull
or the provided name is blank ornull
InsufficientPermissionException
- If this is targeting a TextChannel and the currently logged in account does not havePermission.MESSAGE_ATTACH_FILES
-
addFile
@Nonnull @CheckReturnValue default MessageAction addFile(@Nonnull byte[] data, @Nonnull String name, @Nonnull AttachmentOption... options) Adds the provided byte[] as file data.To reset all files use
clearFiles()
- Parameters:
data
- The byte[] that will be interpreted as file dataname
- The file name that should be used to interpret the type of the given data using the file-name extension. This name is similar to what will be visible throughMessage.Attachment.getFileName()
options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalStateException
- If the file limit of 10 has been reached prior to calling this methodIllegalArgumentException
- If the provided data isnull
or the provided name is blank ornull
or if the provided data exceeds the maximum file size of the currently logged in accountInsufficientPermissionException
- If this is targeting a TextChannel and the currently logged in account does not havePermission.MESSAGE_ATTACH_FILES
- See Also:
-
addFile
@Nonnull @CheckReturnValue default MessageAction addFile(@Nonnull File file, @Nonnull AttachmentOption... options) Adds the providedFile
as file data.
Shortcut foraddFile(file, file.getName())
with the same side-effects.- Parameters:
file
- The File that will be interpreted as file dataoptions
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalStateException
- If the file limit of 10 has been reached prior to calling this methodIllegalArgumentException
- If the provided file isnull
or if the provided File is bigger than the maximum file size of the currently logged in accountInsufficientPermissionException
- If this is targeting a TextChannel and the currently logged in account does not havePermission.MESSAGE_ATTACH_FILES
- See Also:
-
addFile
@Nonnull @CheckReturnValue MessageAction addFile(@Nonnull File file, @Nonnull String name, @Nonnull AttachmentOption... options) Adds the providedFile
as file data.To reset all files use
clearFiles()
This method opens aFileInputStream
which will be closed by executing this action or usingclearFiles()
!- Parameters:
file
- The File that will be interpreted as file dataname
- The file name that should be used to interpret the type of the given data using the file-name extension. This name is similar to what will be visible throughMessage.Attachment.getFileName()
options
- Possible options to apply to this attachment, such as marking it as spoiler image- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalStateException
- If the file limit of 10 has been reached prior to calling this methodIllegalArgumentException
- If the provided file isnull
or the provided name is blank ornull
or if the provided file is bigger than the maximum file size of the currently logged in account, or if the provided file does not exist/ is not readableInsufficientPermissionException
- If this is targeting a TextChannel and the currently logged in account does not havePermission.MESSAGE_ATTACH_FILES
- See Also:
-
clearFiles
Clears all previously added files
And closesFileInputStreams
generated byaddFile(File, String, net.dv8tion.jda.api.utils.AttachmentOption...)
.
To close all stream (including ones given byaddFile(InputStream, String, net.dv8tion.jda.api.utils.AttachmentOption...)
) useclearFiles(Consumer)
.- Returns:
- Updated MessageAction for chaining convenience
- See Also:
-
clearFiles
@Nonnull @CheckReturnValue MessageAction clearFiles(@Nonnull BiConsumer<String, InputStream> finalizer) Clears all previously added files- Parameters:
finalizer
- BiConsumer useful to close remaining resources, the consumer will receive the name as a string parameter and the resource asInputStream
.- Returns:
- Updated MessageAction for chaining convenience
- See Also:
-
clearFiles
Clears all previously added files
TheclearFiles(BiConsumer)
version provides the resource name for more selective operations.- Parameters:
finalizer
- Consumer useful to close remaining resources, the consumer will receive only the resource in the form of anInputStream
- Returns:
- Updated MessageAction for chaining convenience
- See Also:
-
retainFilesById
Removes all attachments that are currently attached to the existing message except for the ones provided.
For exampleretainFilesById(Arrays.asList("123"))
would remove all attachments except for the one with the id 123.To remove all attachments from the message you can pass an empty list.
- Parameters:
ids
- The ids for the attachments which should be retained on the message- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If any of the ids is null or not a valid snowflake
-
retainFilesById
Removes all attachments that are currently attached to the existing message except for the ones provided.
For exampleretainFilesById(Arrays.asList("123"))
would remove all attachments except for the one with the id 123.To remove all attachments from the message you can pass an empty list.
- Parameters:
ids
- The ids for the attachments which should be retained on the message- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If any of the ids is null or not a valid snowflake
-
retainFilesById
Removes all attachments that are currently attached to the existing message except for the ones provided.
For exampleretainFilesById(Arrays.asList("123"))
would remove all attachments except for the one with the id 123.To remove all attachments from the message you can pass an empty list.
- Parameters:
ids
- The ids for the attachments which should be retained on the message- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If any of the ids is null or not a valid snowflake
-
retainFiles
@Nonnull @CheckReturnValue default MessageAction retainFiles(@Nonnull Collection<? extends Message.Attachment> attachments) Removes all attachments that are currently attached to the existing message except for the ones provided.
For exampleretainFiles(message.getAttachments().subList(1, message.getAttachments().size()))
would only remove the first attachment from the message.To remove all attachments from the message you can pass an empty list.
- Parameters:
attachments
- The attachments which should be retained on the message- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If any of the ids is null or not a valid snowflake
-
setActionRows
@Nonnull @CheckReturnValue default MessageAction setActionRows(@Nonnull Collection<? extends ActionRow> rows) Set the action rows for the message.- Parameters:
rows
- The new action rows- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, more than 5 action rows are provided, or any customid
is duplicated
-
setActionRows
Set the action rows for the message.- Parameters:
rows
- The new action rows- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, more than 5 action rows are provided, or any customid
is duplicated
-
setActionRow
@Nonnull @CheckReturnValue default MessageAction setActionRow(@Nonnull Collection<? extends ItemComponent> components) Create one row of up to 5 messagecomponents
.
This is identical tosetActionRows(ActionRow.of(components))
- Parameters:
components
- The components for this action row- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, an invalid number of components is provided, or any customid
is duplicated- See Also:
-
setActionRow
Create one row of up to 5 messagecomponents
.
This is identical tosetActionRows(ActionRow.of(components))
- Parameters:
components
- The components for this action row- Returns:
- Updated MessageAction for chaining convenience
- Throws:
IllegalArgumentException
- If null is provided, an invalid number of components is provided, or any customid
is duplicated- See Also:
-
override
Whether all fields should be considered when editing a message- Parameters:
bool
- True, to override all fields even if they are not set- Returns:
- Updated MessageAction for chaining convenience
-