Class CommandEditActionImpl
- All Implemented Interfaces:
RestAction<Command>
,CommandEditAction
-
Field Summary
Fields inherited from class net.dv8tion.jda.internal.requests.RestActionImpl
LOG
-
Constructor Summary
ConstructorsConstructorDescriptionCommandEditActionImpl
(Guild guild, Command.Type type, String id) CommandEditActionImpl
(JDA api, Command.Type type, String id) -
Method Summary
Modifier and TypeMethodDescriptionaddCheck
(BooleanSupplier checks) Shortcut forsetCheck(() -> getCheck().getAsBoolean() && checks.getAsBoolean())
.addOptions
(OptionData... options) Adds up to 25 options to this command.addSubcommandGroups
(SubcommandGroupData... groups) Add up to 25Subcommand-Groups
to this command.addSubcommands
(SubcommandData... subcommands) Add up to 25Subcommands
to this command.apply
(CommandData commandData) Replace the command with the providedCommandData
.Removes all existing options/subcommands/groups from this command.deadline
(long timestamp) Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.setCheck
(BooleanSupplier checks) Sets the last-second checks before finally executing the http request in the queue.setContexts
(Collection<InteractionContextType> contexts) Sets the contexts in which this command can be executed (Default: Guild and Bot DMs).setDefaultPermissions
(DefaultMemberPermissions permission) Sets thePermissions
that a user must have in a specific channel to be able to use this command.setDescription
(String description) Configure the descriptionsetIntegrationTypes
(Collection<IntegrationType> integrationTypes) Sets the integration types on which this command can be installed on (Default: Guilds).Configure the namesetNSFW
(boolean nsfw) Sets whether this command should only be usable in NSFW (age-restricted) channels.Timeout for this RestAction instance.Methods inherited from class net.dv8tion.jda.internal.requests.RestActionImpl
complete, getCheck, getDefaultFailure, getDefaultSuccess, getDefaultTimeout, getJDA, handleResponse, isPassContext, priority, queue, setDefaultFailure, setDefaultSuccess, setDefaultTimeout, setErrorMapper, setPassContext, submit
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.CommandEditAction
addOption, addOption, addOptions, addSubcommandGroups, addSubcommands, setContexts, setIntegrationTypes
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Constructor Details
-
CommandEditActionImpl
-
CommandEditActionImpl
-
-
Method Details
-
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 interfaceCommandEditAction
- Specified by:
setCheck
in interfaceRestAction<Command>
- Overrides:
setCheck
in classRestActionImpl<Command>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
- 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 interfaceCommandEditAction
- Specified by:
deadline
in interfaceRestAction<Command>
- Overrides:
deadline
in classRestActionImpl<Command>
- Parameters:
timestamp
- Millisecond timestamp at which the request will timeout- Returns:
- The same RestAction with the applied deadline
- See Also:
-
apply
Description copied from interface:CommandEditAction
Replace the command with the providedCommandData
.- Specified by:
apply
in interfaceCommandEditAction
- Parameters:
commandData
- The data for the command- Returns:
- The CommandEditAction instance, for chaining
- See Also:
-
addCheck
Description copied from interface:RestAction
Shortcut forsetCheck(() -> getCheck().getAsBoolean() && checks.getAsBoolean())
.- Specified by:
addCheck
in interfaceCommandEditAction
- Specified by:
addCheck
in interfaceRestAction<Command>
- Parameters:
checks
- Other checks to run- 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 interfaceCommandEditAction
- Specified by:
timeout
in interfaceRestAction<Command>
- Parameters:
timeout
- The timeout to useunit
-Unit
for the timeout value- Returns:
- The same RestAction instance with the applied timeout
- See Also:
-
setName
Description copied from interface:CommandEditAction
Configure the name- Specified by:
setName
in interfaceCommandEditAction
- Parameters:
name
- The lowercase alphanumeric (with dash) name, 1-32 characters. Use null to keep the current name.- Returns:
- The CommandEditAction instance, for chaining
-
setContexts
Description copied from interface:CommandEditAction
Sets the contexts in which this command can be executed (Default: Guild and Bot DMs).
This only has an effect if this command is registered globally.- Specified by:
setContexts
in interfaceCommandEditAction
- Parameters:
contexts
- The contexts in which this command can be executed- Returns:
- The builder instance, for chaining
-
setIntegrationTypes
@Nonnull public CommandEditAction setIntegrationTypes(@Nonnull Collection<IntegrationType> integrationTypes) Description copied from interface:CommandEditAction
Sets the integration types on which this command can be installed on (Default: Guilds).
This only has an effect if this command is registered globally.- Specified by:
setIntegrationTypes
in interfaceCommandEditAction
- Parameters:
integrationTypes
- The integration types on which this command can be installed on- Returns:
- The builder instance, for chaining
-
setNSFW
Description copied from interface:CommandEditAction
Sets whether this command should only be usable in NSFW (age-restricted) channels.
Default: falseNote: Age-restricted commands will not show up in direct messages by default unless the user enables them in their settings.
- Specified by:
setNSFW
in interfaceCommandEditAction
- Parameters:
nsfw
- True, to make this command nsfw- Returns:
- The CommandEditAction instance, for chaining
- See Also:
-
setDefaultPermissions
@Nonnull public CommandEditAction setDefaultPermissions(@Nonnull DefaultMemberPermissions permission) Description copied from interface:CommandEditAction
Sets thePermissions
that a user must have in a specific channel to be able to use this command.
By default, everyone can use this command (DefaultMemberPermissions.ENABLED
). Additionally, a command can be disabled for everyone but admins viaDefaultMemberPermissions.DISABLED
.These configurations can be overwritten by moderators in each guild. See
Command.retrievePrivileges(net.dv8tion.jda.api.entities.Guild)
to get moderator defined overrides.- Specified by:
setDefaultPermissions
in interfaceCommandEditAction
- Parameters:
permission
-DefaultMemberPermissions
representing the default permissions of this command.- Returns:
- The CommandEditAction instance, for chaining
- See Also:
-
setDescription
Description copied from interface:CommandEditAction
Configure the description- Specified by:
setDescription
in interfaceCommandEditAction
- Parameters:
description
- The description, 1-100 characters. Use null to keep the current description.- Returns:
- The CommandEditAction instance, for chaining
-
clearOptions
Description copied from interface:CommandEditAction
Removes all existing options/subcommands/groups from this command.- Specified by:
clearOptions
in interfaceCommandEditAction
- Returns:
- The CommandEditAction instance, for chaining
-
addOptions
Description copied from interface:CommandEditAction
Adds up to 25 options to this command.
This will replace any existing options/subcommands/groups on the command.Required options must be added before non-required options!
- Specified by:
addOptions
in interfaceCommandEditAction
- Parameters:
options
- TheOptions
to add- Returns:
- The CommandEditAction instance, for chaining
-
addSubcommands
Description copied from interface:CommandEditAction
Add up to 25Subcommands
to this command.
This will replace any existing options/subcommands/groups on the command.- Specified by:
addSubcommands
in interfaceCommandEditAction
- Parameters:
subcommands
- The subcommands to add- Returns:
- The CommandEditAction instance, for chaining
-
addSubcommandGroups
Description copied from interface:CommandEditAction
Add up to 25Subcommand-Groups
to this command.
This will replace any existing options/subcommands/groups on the command.- Specified by:
addSubcommandGroups
in interfaceCommandEditAction
- Parameters:
groups
- The subcommand groups to add- Returns:
- The CommandEditAction instance, for chaining
-