class ApplicationCommand

extends

Base
export class ApplicationCommand<PermissionsFetchType = {}> extends Base

Represents an application command.

Type Parameters

optional
PermissionsFetchType? = {}

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

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

readonly
manager : ApplicationCommandManager

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.

Examples:
// Delete this command
command.delete()
  .then(console.log)
  .catch(console.error);

edit() : Promise<ApplicationCommand<PermissionsFetchType>>

Edits this application command.

Examples:
// 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[]
enforceOptionOrder?: boolean
) : 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

Examples:
// 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)

setDMPermission(
dmPermission?: boolean
) : Promise<ApplicationCommand<PermissionsFetchType>>

Edits the DM permission of this ApplicationCommand

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

Examples:
// Edit the name localizations of this command
command.setLocalizedNames({
  '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

toJSON(
...props: Record<string, boolean | string>[]
) : unknown

Inherited from: Base

valueOf() : string

Inherited from: Base