ApplicationCommand

export class ApplicationCommand<PermissionsFetchType = {}> extends Base
export class ApplicationCommand<PermissionsFetchType = {}> extends Base
Represents an application command.

Extends

Base
NameConstraintsOptionalDefaultDescription
PermissionsFetchTypeYes{}None
applicationId:Snowflake
The parent application's id
Readonly
client:Client<true>
The client that instantiated this
Inherited from Base
Interaction context(s) where the command can be used Only for globally-scoped commands
Readonly
createdAt:Date
The time the command was created at
Readonly
createdTimestamp: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
descriptionLocalized:string | null
The localized description for this command
Deprecated
dmPermission:boolean | null
Use contexts instead.
Deprecated
Whether the command can be used in DMs This property is always null on guild commands
guild:Guild | null
The guild this command is part of
guildId:Snowflake | null
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
The command's id
integrationTypes:ApplicationIntegrationType[] | null
Installation context(s) where the command is available Only for globally-scoped commands
The manager that this command belongs to
name:string
The name of this command
nameLocalizations:LocalizationMap | null
The name localizations for this command
nameLocalized:string | null
The localized name for this command
nsfw:boolean
Whether this command is age-restricted (18+)
options:(ApplicationCommandOption & { nameLocalized?: string; descriptionLocalized?: 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
The type of this application command
version:Snowflake
Autoincrementing version identifier updated during substantial record changes
delete():Promise<ApplicationCommand<PermissionsFetchType>>
Deletes this command.
Example
// Delete this command
command.delete()
.then(console.log)
.catch(console.error);
// Delete this command
command.delete()
.then(console.log)
.catch(console.error);
edit(data):Promise<ApplicationCommand<PermissionsFetchType>>
Edits this application command.
Example
// Edit the description of this command
command.edit({
description: 'New description',
})
.then(console.log)
.catch(console.error);
// Edit the description of this command
command.edit({
description: 'New description',
})
.then(console.log)
.catch(console.error);
NameTypeOptionalDescription
dataPartial<ApplicationCommandData>NoThe data to update the command with
equals(command, enforceOptionOrder?):boolean
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.
NameTypeOptionalDescription
commandApplicationCommand | ApplicationCommandData | RawApplicationCommandDataNoThe command to compare with
enforceOptionOrderbooleanYesWhether to strictly check that options and choices are in the same order in the array The client may not always respect this ordering!
Static
optionsEqual(existing, options, enforceOptionOrder?):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
NameTypeOptionalDescription
existingreadonly ApplicationCommandOption[]NoThe options on the existing command, should be options
options readonly ApplicationCommandOption[] | readonly ApplicationCommandOptionData[] | readonly APIApplicationCommandOption[]NoThe options to compare against
enforceOptionOrderbooleanYesWhether to strictly check that options and choices are in the same order in the array The client may not always respect this ordering!
setDefaultMemberPermissions(defaultMemberPermissions):Promise<ApplicationCommand<PermissionsFetchType>>
Edits the default member permissions of this ApplicationCommand
NameTypeOptionalDescription
defaultMemberPermissionsPermissionResolvable | nullNoThe default member permissions required to run this command
setDescription(description):Promise<ApplicationCommand<PermissionsFetchType>>
Edits the description of this ApplicationCommand
NameTypeOptionalDescription
descriptionstringNoThe new description of the command
setDescriptionLocalizations(descriptionLocalizations):Promise<ApplicationCommand<PermissionsFetchType>>
Edits the localized descriptions of this ApplicationCommand
Example
// 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)
// 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)
NameTypeOptionalDescription
descriptionLocalizationsLocalizationMapNoThe new localized descriptions for the command
setDMPermission(dmPermission?):Promise<ApplicationCommand<PermissionsFetchType>>
Edits the DM permission of this ApplicationCommand
NameTypeOptionalDescription
dmPermissionbooleanYesWhether the command can be used in DMs
setName(name):Promise<ApplicationCommand<PermissionsFetchType>>
Edits the name of this ApplicationCommand
NameTypeOptionalDescription
namestringNoThe new name of the command
setNameLocalizations(nameLocalizations):Promise<ApplicationCommand<PermissionsFetchType>>
Edits the localized names of this ApplicationCommand
Example
// Edit the name localizations of this command
command.setLocalizedNames({
'en-GB': 'test',
'pt-BR': 'teste',
})
.then(console.log)
.catch(console.error)
// Edit the name localizations of this command
command.setLocalizedNames({
'en-GB': 'test',
'pt-BR': 'teste',
})
.then(console.log)
.catch(console.error)
NameTypeOptionalDescription
nameLocalizationsLocalizationMapNoThe new localized names for the command
setOptions(options):Promise<ApplicationCommand<PermissionsFetchType>>
Edits the options of this ApplicationCommand
NameTypeOptionalDescription
optionsreadonly ApplicationCommandOptionData[]NoThe options to set for this command
toJSON(...props):unknown
NameTypeOptionalDescription
...propsRecord<string, boolean | string>[]NoNone
Inherited from Base
valueOf():string