Skip to content

$createApplicationCommand

$createApplicationCommand will create an application command.

Usage

$createApplicationCommand[type;name;description;permissions;integrationType?;context?;options?]

Parameters

FieldTypeDescriptionRequired
typestring, numberApplication command type.
1. global
2. specific guildID
true
namestringApplication command name, must be lowercase.true
descriptionstringApplication command description.true
permissions?stringIf the command should be restricted to certain permissions.false
integrationType?stringThe application command integration type.
1. user
2. guild
false
context?stringThe application command context.
1. botdm
2. dm
3. guild
false
type?stringThe application command type.
1. slash
2. user
3. message
false
options?stringApplication command options.false

Application Command Option Type

NAMEIDNOTE
SUB_COMMAND1
SUB_COMMAND_GROUP2
STRING3
NUMBER4Any Number between -2^53 and 2^53
BOOLEAN5
USER6
CHANNEL7Includes all channel types + categories
ROLE8
MENTIONABLE9Includes users and roles
NUMBER10Any double between -2^53 and 2^53
ATTACHMENT11attachment object

You can find more information in the official documentation of Discord’s API.

Example(s)

Check the Slash Command/Interaction guide for more information about slash commands! You can also use the Application Command Creator to easily create your own custom application commands for your application.

This will create a guild slash command without options:

1
client.command({
2
name: "createApplicationCommand",
3
code: `
4
$createApplicationCommand[$guildID/global;example;slash command description!;false;guild;guild;slash]`
5
});
6
// Will create a slash commands without any user input, you can choose between global/$guildID to create a command globally or only for a specific guild.

This will create a guild slash command with restricted permissions, without options:

1
client.command({
2
name: "createApplicationCommand",
3
code: `
4
$createApplicationCommand[$guildID/global;example;slash command description!;managemessages;guild;guild;slash]`
5
});
6
// Will create a slash commands without any user input but with restricted permissions (managemessages), you can choose between global/$guildID to create a command globally or only for a specific guild.