Skip to content

$createApplicationCommand

$createApplicationCommand will create an application command.

Usage

$createApplicationCommand[guildID/global;name;description;defaultPermission;allowDm?;type?;options?]

Parameters

FieldTypeDescriptionRequired
guildID/globalstring, numberApplication command type.
1. global
2. specific guildID
true
namestringApplication command name, must be lowercase.true
descriptionstringApplication command description.true
defaultPermissionsbooleanIf the command should follow the default permissions.true
allowDm?booleanAllow Direct Message execution.true
type?stringThe application command type. (slash/user/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!

This will create a slash command without options:

1
client.command({
2
name: "createApplicationCommand",
3
code: `
4
$createApplicationCommand[$guildID/global;example;slash command description!;true;true;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.