class ApplicationCommand
extends
Baseexport class ApplicationCommand<PermissionsFetchType = {}> extends Base
Represents an application command.
Type Parameters
optional{} PermissionsFetchType? =
Snowflake applicationId :
The parent application's id
InteractionContextType[] | null contexts :
Interaction context(s) where the command can be used Only for globally-scoped commands
readonlyDate createdAt :
The time the command was created at
readonlynumber createdTimestamp :
The timestamp the command was created at
Readonly<PermissionsBitField> | null defaultMemberPermissions :
The default bitfield used to determine whether this command be used in a guild
string description :
The description of this command
LocalizationMap | null descriptionLocalizations :
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
Snowflake id :
The command's id
ApplicationIntegrationType[] | null integrationTypes :
Installation context(s) where the command is available Only for globally-scoped commands
readonlyApplicationCommandManager manager :
The manager that this command belongs to
string name :
The name of this command
LocalizationMap | null nameLocalizations :
The name localizations for this command
boolean nsfw :
Whether this command is age-restricted (18+)
(ApplicationCommandOption & { nameLocalized?: string; descriptionLocalized?: string })[] options :
The options of this command
ApplicationCommandPermissionsManager<PermissionsFetchType, PermissionsFetchType, Guild | null, Snowflake> permissions :
The manager for permissions of this command on its guild or arbitrary guilds when the command is global
ApplicationCommandType type :
The type of this application command
Snowflake version :
Autoincrementing version identifier updated during substantial record changes
deletePromise<ApplicationCommand<PermissionsFetchType>> () :
Deletes this command.
// Delete this command
command.delete()
.then(console.log)
.catch(console.error);
editdata: 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 optionsEqualexisting: readonly ApplicationCommandOption[]options: readonly ApplicationCommandOption[] | readonly ApplicationCommandOptionData[] | readonly APIApplicationCommandOption[]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
setDefaultMemberPermissionsdefaultMemberPermissions: PermissionResolvable | null) : Promise<ApplicationCommand<PermissionsFetchType>> (
Edits the default member permissions of this ApplicationCommand
setDescriptiondescription: string) : Promise<ApplicationCommand<PermissionsFetchType>> (
Edits the description of this ApplicationCommand
setDescriptionLocalizationsdescriptionLocalizations: 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)
setNamename: string) : Promise<ApplicationCommand<PermissionsFetchType>> (
Edits the name of this ApplicationCommand
setNameLocalizationsnameLocalizations: LocalizationMap) : Promise<ApplicationCommand<PermissionsFetchType>> (
Edits the localized names of this ApplicationCommand
// Edit the name localizations of this command
command.setLocalizedNames({
'en-GB': 'test',
'pt-BR': 'teste',
})
.then(console.log)
.catch(console.error)
setOptionsoptions: readonly ApplicationCommandOptionData[]) : Promise<ApplicationCommand<PermissionsFetchType>> (
Edits the options of this ApplicationCommand