Interface Command
- All Superinterfaces:
Formattable
,ICommandReference
,IMentionable
,ISnowflake
Represents a Discord slash-command.
This can be used to edit or delete the command.
This can be used to edit or delete the command.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Predefined choice used for options.static class
An Option for a command.static class
An Subcommand for a command.static class
An Subcommand Group for a command.static enum
Possible command types -
Method Summary
Modifier and TypeMethodDescriptiondelete()
Delete this command.Edit this command.default String
The id of the application this command belongs to.long
The id of the application this command belongs to.TheDefaultMemberPermissions
of this command.The description of this command.The localizations of this command's description forvarious languages
.getJDA()
Returns theJDA
instance of this CommandgetName()
The name of this command.The localizations of this command's name forvarious languages
.@Unmodifiable List<Command.Option>
TheOptions
of this command.@Unmodifiable List<Command.SubcommandGroup>
TheSubcommandGroups
of this command.@Unmodifiable List<Command.Subcommand>
TheSubcommands
of this command.default OffsetDateTime
The time this command was updated last.getType()
TheCommand.Type
of commandlong
The version of this command.boolean
Whether the command can only be used inside a guild.boolean
isNSFW()
Whether this command is restricted to NSFW (age-restricted) channels.retrievePrivileges
(Guild guild) Retrieves theIntegrationPrivileges
for this command.Methods inherited from interface net.dv8tion.jda.api.interactions.commands.ICommandReference
getAsMention, getFullCommandName
Methods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatTo
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
delete
Delete this command.- Returns:
RestAction
- Throws:
IllegalStateException
- If this command is not owned by this bot
-
editCommand
Edit this command.
This can be used to change the command attributes such as name or description.- Returns:
CommandEditAction
- Throws:
IllegalStateException
- If this command is not owned by this bot
-
retrievePrivileges
@Nonnull @CheckReturnValue RestAction<List<IntegrationPrivilege>> retrievePrivileges(@Nonnull Guild guild) Retrieves theIntegrationPrivileges
for this command.
This is a shortcut forGuild.retrieveIntegrationPrivilegesById(String)
.Moderators of a guild can modify these privileges through the Integrations Menu
If there is no command with the provided ID, this RestAction fails with
ErrorResponse.UNKNOWN_COMMAND
- Parameters:
guild
- The target guild from which to retrieve the privileges- Returns:
RestAction
- Type:List
ofIntegrationPrivilege
- Throws:
IllegalArgumentException
- If the guild is null
-
getJDA
Returns theJDA
instance of this Command- Returns:
- the corresponding JDA instance
-
getType
TheCommand.Type
of command- Returns:
- The command type
-
getName
The name of this command.- Specified by:
getName
in interfaceICommandReference
- Returns:
- The name
-
getNameLocalizations
The localizations of this command's name forvarious languages
.- Returns:
- The
LocalizationMap
containing the mapping fromDiscordLocale
to the localized name
-
getDescription
The description of this command.- Returns:
- The description, empty for context menu commands
-
getDescriptionLocalizations
The localizations of this command's description forvarious languages
.- Returns:
- The
LocalizationMap
containing the mapping fromDiscordLocale
to the localized description
-
getOptions
TheOptions
of this command.- Returns:
- Immutable list of command options
-
getSubcommands
TheSubcommands
of this command.- Returns:
- Immutable list of subcommands
-
getSubcommandGroups
TheSubcommandGroups
of this command.- Returns:
- Immutable list of subcommand groups
-
getApplicationIdLong
long getApplicationIdLong()The id of the application this command belongs to.- Returns:
- The application id
-
getApplicationId
The id of the application this command belongs to.- Returns:
- The application id
-
getVersion
long getVersion()The version of this command.
This changes when a command is updated throughupsertCommand
,updateCommands
, oreditCommandById
Useful for checking if command cache is outdated- Returns:
- The version of the command as a snowflake id.
- See Also:
-
getTimeModified
The time this command was updated last.- Returns:
- Time this command was updated last.
- See Also:
-
getDefaultPermissions
TheDefaultMemberPermissions
of this command.
If this command has no default permission set, this returnsDefaultMemberPermissions.ENABLED
.- Returns:
- The DefaultMemberPermissions of this command.
-
isGuildOnly
boolean isGuildOnly()Whether the command can only be used inside a guild.
Always true for guild commands.- Returns:
- True, if this command is restricted to guilds.
-
isNSFW
boolean isNSFW()Whether this command is restricted to NSFW (age-restricted) channels.- Returns:
- True, if this command is NSFW
- See Also:
-