GuildApplicationCommandManager

export class GuildApplicationCommandManager extends ApplicationCommandManager<ApplicationCommand, {}, Guild>
export class GuildApplicationCommandManager extends ApplicationCommandManager<ApplicationCommand, {}, Guild>
An extension for guild-specific application commands.
Readonly
cache:Collection<Key, Holds>
The cache of items for this manager.
Inherited from DataManager
Readonly
client:Client
The client that instantiated this Manager
Inherited from BaseManager
guild:Guild
The guild that this manager belongs to
Readonly
holds:Constructable<Holds>
The data structure belonging to this manager.
Inherited from DataManager
The manager for permissions of arbitrary commands on arbitrary guilds
Inherited from ApplicationCommandManager
create(command):Promise<ApplicationCommand>
Creates an application command.
Example
// Create a new command
client.application.commands.create({
name: 'test',
description: 'A test command',
})
.then(console.log)
.catch(console.error);
// Create a new command
client.application.commands.create({
name: 'test',
description: 'A test command',
})
.then(console.log)
.catch(console.error);
NameTypeOptionalDescription
commandApplicationCommandDataResolvableNoThe command
delete(command):Promise<ApplicationCommand | null>
Deletes an application command.
Example
// Delete a command
guild.commands.delete('123456789012345678')
.then(console.log)
.catch(console.error);
// Delete a command
guild.commands.delete('123456789012345678')
.then(console.log)
.catch(console.error);
NameTypeOptionalDescription
commandApplicationCommandResolvableNoThe command to delete
edit(command, data):Promise<ApplicationCommand>
Edits an application command.
Example
// Edit an existing command
client.application.commands.edit('123456789012345678', {
description: 'New description',
})
.then(console.log)
.catch(console.error);
// Edit an existing command
client.application.commands.edit('123456789012345678', {
description: 'New description',
})
.then(console.log)
.catch(console.error);
NameTypeOptionalDescription
commandApplicationCommandResolvableNoThe command to edit
dataPartial<ApplicationCommandDataResolvable>NoThe data to update the command with
fetch(id, options?):Promise<ApplicationCommand>
Obtains one or multiple application commands from Discord, or the cache if it's already available.
Example
// Fetch a single command
client.application.commands.fetch('123456789012345678')
.then(command => console.log(`Fetched command ${command.name}`))
.catch(console.error);
// Fetch a single command
client.application.commands.fetch('123456789012345678')
.then(command => console.log(`Fetched command ${command.name}`))
.catch(console.error);
Example
// Fetch all commands
guild.commands.fetch()
.then(commands => console.log(`Fetched ${commands.size} commands`))
.catch(console.error);
// Fetch all commands
guild.commands.fetch()
.then(commands => console.log(`Fetched ${commands.size} commands`))
.catch(console.error);
NameTypeOptionalDescription
idSnowflakeNoOptions for fetching application command(s)
optionsFetchGuildApplicationCommandFetchOptionsYesAdditional options for this fetch
resolve(idOrInstance):Holds
Resolves a data entry to a data Object.
Returns
An instance from this Manager
NameTypeOptionalDescription
idOrInstanceHoldsNoThe id or instance of something in this Manager
resolveId(idOrInstance):Key
Resolves a data entry to an instance id.
Returns
NameTypeOptionalDescription
idOrInstanceKey | HoldsNoThe id or instance of something in this Manager
Sets all the commands for this application or guild.
Example
// Set all commands to just this one
client.application.commands.set([
{
name: 'test',
description: 'A test command',
},
])
.then(console.log)
.catch(console.error);
// Set all commands to just this one
client.application.commands.set([
{
name: 'test',
description: 'A test command',
},
])
.then(console.log)
.catch(console.error);
Example
// Remove all commands
guild.commands.set([])
.then(console.log)
.catch(console.error);
// Remove all commands
guild.commands.set([])
.then(console.log)
.catch(console.error);
NameTypeOptionalDescription
commandsreadonly ApplicationCommandDataResolvable[]NoThe commands
valueOf():Collection<Key, Holds>