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
Nested ClassesModifier and TypeInterfaceDescriptionstatic classPredefined choice used for options.static classAn Option for a command.static classAn Subcommand for a command.static classAn Subcommand Group for a command.static enumPossible command types -
Method Summary
Modifier and TypeMethodDescriptiondelete()Delete this command.Edit this command.default StringThe id of the application this command belongs to.longThe id of the application this command belongs to.TheDefaultMemberPermissionsof this command.The description of this command.The localizations of this command's description forvarious languages.getJDA()Returns theJDAinstance of this CommandgetName()The name of this command.The localizations of this command's name forvarious languages.@Unmodifiable List<Command.Option>TheOptionsof this command.@Unmodifiable List<Command.SubcommandGroup>TheSubcommandGroupsof this command.@Unmodifiable List<Command.Subcommand>TheSubcommandsof this command.default OffsetDateTimeThe time this command was updated last.getType()TheCommand.Typeof commandlongThe version of this command.booleanWhether the command can only be used inside a guild.booleanisNSFW()Whether this command is restricted to NSFW (age-restricted) channels.retrievePrivileges(Guild guild) Retrieves theIntegrationPrivilegesfor this command.Methods inherited from interface net.dv8tion.jda.api.interactions.commands.ICommandReference
getAsMention, getFullCommandNameMethods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatToMethods 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 theIntegrationPrivilegesfor 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:ListofIntegrationPrivilege- Throws:
IllegalArgumentException- If the guild is null
-
getJDA
Returns theJDAinstance of this Command- Returns:
- the corresponding JDA instance
-
getType
TheCommand.Typeof command- Returns:
- The command type
-
getName
The name of this command.- Specified by:
getNamein interfaceICommandReference- Returns:
- The name
-
getNameLocalizations
The localizations of this command's name forvarious languages.- Returns:
- The
LocalizationMapcontaining the mapping fromDiscordLocaleto 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
LocalizationMapcontaining the mapping fromDiscordLocaleto the localized description
-
getOptions
TheOptionsof this command.- Returns:
- Immutable list of command options
-
getSubcommands
TheSubcommandsof this command.- Returns:
- Immutable list of subcommands
-
getSubcommandGroups
TheSubcommandGroupsof 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
TheDefaultMemberPermissionsof 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:
-