export class ApplicationCommandManager<ApplicationCommandScope = ApplicationCommand<{ guild: GuildResolvable }>, PermissionsOptionsExtras = { guild: GuildResolvable }, PermissionsGuildType = null,> extends CachedManager<Snowflake, ApplicationCommandScope, ApplicationCommandResolvable>Manages API methods for application commands and stores their cache.
Constructors
Constructs a new instance of the ApplicationCommandManager class
Type Parameters
optionalApplicationCommandScope? = ApplicationCommand<{ guild: GuildResolvable }>
optionalPermissionsOptionsExtras? = { guild: GuildResolvable }
optionalPermissionsGuildType? = null
readonlycache : Collection<Key, Holds>
The cache of items for this manager.
Inherited from: DataManager
guild : GuildResolvable
readonlyholds : Constructable<Holds>
The data structure belonging to this manager.
Inherited from: DataManager
permissions : ApplicationCommandPermissionsManager<{ command?: ApplicationCommandResolvable } & PermissionsOptionsExtras, { command: ApplicationCommandResolvable } & PermissionsOptionsExtras, PermissionsGuildType, null>
The manager for permissions of arbitrary commands on arbitrary guilds
create(command: ApplicationCommandDataResolvableguildId?: Snowflake) : Promise<ApplicationCommandScope>
command: ApplicationCommandDataResolvable
guildId?: Snowflake
Creates an application command.
Examples:
// Create a new command
client.application.commands.create({
name: 'test',
description: 'A test command',
})
.then(console.log)
.catch(console.error); delete(command: ApplicationCommandResolvableguildId?: Snowflake) : Promise<ApplicationCommandScope | null>
command: ApplicationCommandResolvable
guildId?: Snowflake
Deletes an application command.
Examples:
// Delete a command
guild.commands.delete('123456789012345678')
.then(console.log)
.catch(console.error);Overload 1
Overload 2
edit(command: ApplicationCommandResolvable) : Promise<ApplicationCommandScope>
command: ApplicationCommandResolvable
Edits an application command.
Examples:
// Edit an existing command
client.application.commands.edit('123456789012345678', {
description: 'New description',
})
.then(console.log)
.catch(console.error);Overload 1
Overload 2
Overload 3
Overload 4
fetch(id: Snowflakeoptions: FetchApplicationCommandOptions & { guildId: Snowflake }) : Promise<ApplicationCommand>
id: Snowflake
options: FetchApplicationCommandOptions & { guildId: Snowflake }
Obtains one or multiple application commands from Discord, or the cache if it's already available.
Examples:
// Fetch a single command
client.application.commands.fetch('123456789012345678')
.then(command => console.log(`Fetched command ${command.name}`))
.catch(console.error);// Fetch all commands
guild.commands.fetch()
.then(commands => console.log(`Fetched ${commands.size} commands`))
.catch(console.error);Overload 1
Overload 2
Overload 1
Overload 2
Overload 1
Overload 2
set(commands: readonly ApplicationCommandDataResolvable[]) : Promise<Collection<Snowflake, ApplicationCommandScope>>
commands: readonly ApplicationCommandDataResolvable[]
Sets all the commands for this application or guild.
Examples:
// Set all commands to just this one
client.application.commands.set([
{
name: 'test',
description: 'A test command',
},
])
.then(console.log)
.catch(console.error);// Remove all commands
guild.commands.set([])
.then(console.log)
.catch(console.error);valueOf() : Collection<Key, Holds>
Inherited from: DataManager