Class CommandImpl
java.lang.Object
net.dv8tion.jda.internal.interactions.command.CommandImpl
- All Implemented Interfaces:
Formattable
,IMentionable
,ISnowflake
,Command
,ICommandReference
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.interactions.commands.Command
Command.Choice, Command.Option, Command.Subcommand, Command.SubcommandGroup, Command.Type
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Predicate
<DataObject> static final Predicate
<DataObject> static final EnumSet
<OptionType> static final Predicate
<DataObject> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondelete()
Delete this command.Edit this command.boolean
long
The id of the application this command belongs to.Retrieve a Mention for this Entity.The contexts in which this command can be used.TheDefaultMemberPermissions
of this command.The description of this command.The localizations of this command's description forvarious languages
.Returns the full command name, including possible subcommand name and subcommand group name.long
The Snowflake id of this entity.Gets the integration types on which this command can be installed on.getJDA()
Returns theJDA
instance of this CommandgetName()
The name of this command.The localizations of this command's name forvarious languages
.TheOptions
of this command.TheSubcommandGroups
of this command.TheSubcommands
of this command.getType()
TheCommand.Type
of commandlong
The version of this command.int
hashCode()
boolean
isNSFW()
Whether this command is restricted to NSFW (age-restricted) channels.static <T> List
<T> parseOptions
(DataObject json, Predicate<DataObject> test, Function<DataObject, T> transform) retrievePrivileges
(Guild guild) Retrieves theIntegrationPrivileges
for this command.toString()
Methods inherited from interface net.dv8tion.jda.api.interactions.commands.Command
getApplicationId, getTimeModified
Methods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatTo
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getTimeCreated
-
Field Details
-
OPTIONS
-
OPTION_TEST
-
SUBCOMMAND_TEST
-
GROUP_TEST
-
-
Constructor Details
-
CommandImpl
-
-
Method Details
-
parseOptions
public static <T> List<T> parseOptions(DataObject json, Predicate<DataObject> test, Function<DataObject, T> transform) -
delete
Description copied from interface:Command
Delete this command.- Specified by:
delete
in interfaceCommand
- Returns:
RestAction
-
editCommand
Description copied from interface:Command
Edit this command.
This can be used to change the command attributes such as name or description.- Specified by:
editCommand
in interfaceCommand
- Returns:
CommandEditAction
-
retrievePrivileges
Description copied from interface:Command
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
- Specified by:
retrievePrivileges
in interfaceCommand
- Parameters:
guild
- The target guild from which to retrieve the privileges- Returns:
RestAction
- Type:List
ofIntegrationPrivilege
-
getJDA
Description copied from interface:Command
Returns theJDA
instance of this Command -
getType
Description copied from interface:Command
TheCommand.Type
of command -
getName
Description copied from interface:Command
The name of this command.- Specified by:
getName
in interfaceCommand
- Specified by:
getName
in interfaceICommandReference
- Returns:
- The name
-
getNameLocalizations
Description copied from interface:Command
The localizations of this command's name forvarious languages
.- Specified by:
getNameLocalizations
in interfaceCommand
- Returns:
- The
LocalizationMap
containing the mapping fromDiscordLocale
to the localized name
-
getFullCommandName
Description copied from interface:ICommandReference
Returns the full command name, including possible subcommand name and subcommand group name.
This is the name shown on messages or when writing the command in the text input.Examples:
- When used on a normal base command, the full name is the name itself, as in the name
"ban"
is equal to the full name"ban"
. - When used on a subcommand
"ban"
, of the base command"mod"
, the full name resolves to"mod ban"
- When the subcommand is part of a subcommand group,
"action"
it resolves to"mod action ban"
- Specified by:
getFullCommandName
in interfaceICommandReference
- Returns:
- the full command name
- When used on a normal base command, the full name is the name itself, as in the name
-
getDescription
Description copied from interface:Command
The description of this command.- Specified by:
getDescription
in interfaceCommand
- Returns:
- The description, empty for context menu commands
-
getDescriptionLocalizations
Description copied from interface:Command
The localizations of this command's description forvarious languages
.- Specified by:
getDescriptionLocalizations
in interfaceCommand
- Returns:
- The
LocalizationMap
containing the mapping fromDiscordLocale
to the localized description
-
getOptions
Description copied from interface:Command
TheOptions
of this command.- Specified by:
getOptions
in interfaceCommand
- Returns:
- Immutable list of command options
-
getSubcommands
Description copied from interface:Command
TheSubcommands
of this command.- Specified by:
getSubcommands
in interfaceCommand
- Returns:
- Immutable list of subcommands
-
getSubcommandGroups
Description copied from interface:Command
TheSubcommandGroups
of this command.- Specified by:
getSubcommandGroups
in interfaceCommand
- Returns:
- Immutable list of subcommand groups
-
getApplicationIdLong
public long getApplicationIdLong()Description copied from interface:Command
The id of the application this command belongs to.- Specified by:
getApplicationIdLong
in interfaceCommand
- Returns:
- The application id
-
getVersion
public long getVersion()Description copied from interface:Command
The version of this command.
This changes when a command is updated throughupsertCommand
,updateCommands
, oreditCommandById
Useful for checking if command cache is outdated- Specified by:
getVersion
in interfaceCommand
- Returns:
- The version of the command as a snowflake id.
- See Also:
-
getDefaultPermissions
Description copied from interface:Command
TheDefaultMemberPermissions
of this command.
If this command has no default permission set, this returnsDefaultMemberPermissions.ENABLED
.- Specified by:
getDefaultPermissions
in interfaceCommand
- Returns:
- The DefaultMemberPermissions of this command.
-
getContexts
Description copied from interface:Command
The contexts in which this command can be used.- Specified by:
getContexts
in interfaceCommand
- Returns:
- The contexts in which this command can be used
-
getIntegrationTypes
Description copied from interface:Command
Gets the integration types on which this command can be installed on.- Specified by:
getIntegrationTypes
in interfaceCommand
- Returns:
- The integration types on which this command can be installed on
-
isNSFW
public boolean isNSFW()Description copied from interface:Command
Whether this command is restricted to NSFW (age-restricted) channels. -
getIdLong
public long getIdLong()Description copied from interface:ISnowflake
The Snowflake id of this entity. This is unique to every entity and will never change.- Specified by:
getIdLong
in interfaceISnowflake
- Returns:
- Long containing the Id.
-
getAsMention
Description copied from interface:ICommandReference
Retrieve a Mention for this Entity. For the publicRole
(@everyone), this will return the literal string"@everyone"
.This will only work on slash commands!
- Specified by:
getAsMention
in interfaceICommandReference
- Specified by:
getAsMention
in interfaceIMentionable
- Returns:
- A resolvable mention.
-
toString
-
equals
-
hashCode
public int hashCode()
-