class ApplicationCommand
extends
Baseexport class ApplicationCommand<PermissionsFetchType = {}> extends BaseRepresents an application command.
Type Parameters
optionalPermissionsFetchType? = {}
applicationId : Snowflake
The parent application's id
contexts : InteractionContextType[] | null
Interaction context(s) where the command can be used Only for globally-scoped commands
readonlycreatedAt : Date
The time the command was created at
readonlycreatedTimestamp : number
The timestamp the command was created at
defaultMemberPermissions : Readonly<PermissionsBitField> | null
The default bitfield used to determine whether this command be used in a guild
description : string
The description of this command
descriptionLocalizations : LocalizationMap | null
The description localizations for this command
The guild's id this command is part of, this may be non-null when guild is null if the command was fetched from the ApplicationCommandManager
handler : EntryPointCommandHandlerType | null
Determines whether the interaction is handled by the app's interactions handler or by Discord. Only available for ApplicationCommandType commands on applications with the ApplicationFlags flag (i.e, those that have an Activity)
id : Snowflake
The command's id
integrationTypes : ApplicationIntegrationType[] | null
Installation context(s) where the command is available Only for globally-scoped commands
readonlymanager : ApplicationCommandManager
The manager that this command belongs to
name : string
The name of this command
nameLocalizations : LocalizationMap | null
The name localizations for this command
nsfw : boolean
Whether this command is age-restricted (18+)
options : (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[]
The options of this command
permissions : ApplicationCommandPermissionsManager<PermissionsFetchType, PermissionsFetchType, Guild | null, Snowflake>
The manager for permissions of this command on its guild or arbitrary guilds when the command is global
type : ApplicationCommandType
The type of this application command
version : Snowflake
Autoincrementing version identifier updated during substantial record changes
delete() : Promise<ApplicationCommand<PermissionsFetchType>>
Deletes this command.
// Delete this command
command.delete()
.then(console.log)
.catch(console.error); edit(data: Partial<ApplicationCommandData>) : Promise<ApplicationCommand<PermissionsFetchType>>
Edits this application command.
// Edit the description of this command
command.edit({
description: 'New description',
})
.then(console.log)
.catch(console.error);Whether this command equals another command. It compares all properties, so for most operations it is advisable to just compare command.id === command2.id as it is much faster and is often what most users need.
static optionsEqual(existing: readonly ApplicationCommandOption[]options: readonly APIApplicationCommandOption[] | readonly ApplicationCommandOption[] | readonly ApplicationCommandOptionData[]enforceOptionOrder?: boolean = false) : boolean
Recursively checks that all options for an ApplicationCommand are equal to the provided options. In most cases it is better to compare using equals
setDefaultMemberPermissions(defaultMemberPermissions: PermissionResolvable | null) : Promise<ApplicationCommand<PermissionsFetchType>>
Edits the default member permissions of this ApplicationCommand
setDescription(description: string) : Promise<ApplicationCommand<PermissionsFetchType>>
Edits the description of this ApplicationCommand
setDescriptionLocalizations(descriptionLocalizations: LocalizationMap) : Promise<ApplicationCommand<PermissionsFetchType>>
Edits the localized descriptions of this ApplicationCommand
// Edit the description localizations of this command
command.setDescriptionLocalizations({
'en-GB': 'A test command',
'pt-BR': 'Um comando de teste',
})
.then(console.log)
.catch(console.error) setName(name: string) : Promise<ApplicationCommand<PermissionsFetchType>>
Edits the name of this ApplicationCommand
setNameLocalizations(nameLocalizations: LocalizationMap) : Promise<ApplicationCommand<PermissionsFetchType>>
Edits the localized names of this ApplicationCommand
// Edit the name localizations of this command
command.setNameLocalizations({
'en-GB': 'test',
'pt-BR': 'teste',
})
.then(console.log)
.catch(console.error) setOptions(options: readonly ApplicationCommandOptionData[]) : Promise<ApplicationCommand<PermissionsFetchType>>
Edits the options of this ApplicationCommand