Skip to content

Subcommand Groups

Table of Contents


Sub command groups

Sub-commands are apart of slash commands and are used to add as the name already suggest sub commands to the regular slash command. Which does not only “bypass” the slash command limit but also allows you to properly structure your application commands.

Creating Application Commands

1
$createApplicationCommand[guildID/global;name;description;defaultPermission(true/false);type(slash/user/message);options?]
FieldTypeDescriptionRequired
guildID/globalstring numberThe type of application command, either for every guild (global) or for one specific guild (specific guildID).true
namestring, numberThe actual slash command name that will be visible to the user.true
descriptionstring, numberThe slash command description that will be visible to the user.true
defaultPermissionstringIf the application command should synchronize to the default permissions.true
typestringThe application command type (explained below)true
options?objectSlash commands options.true

Examples of creating Application Commands with sub command groups

The official documentation can be found here

1
client.command({
2
name: "createApplicationCommand",
3
code: `
4
$createApplicationCommand[guildID/global;moderation;Moderation Commands!;true;true;slash;[{
5
"name": "user",
6
"description": "Get or edit permissions for a user",
7
"type": 2,
8
"options": [
9
{
10
"name": "get",
11
"description": "Get permissions for a user",
12
"type": 1
13
},
14
{
15
"name": "edit",
16
"description": "Edit permissions for a user",
17
"type": 1
18
}
19
]
20
},
21
{
22
"name": "role",
23
"description": "Get or edit permissions for a role",
24
"type": 2,
25
"options": [
26
{
27
"name": "get",
28
"description": "Get permissions for a role",
29
"type": 1
30
},
31
{
32
"name": "edit",
33
"description": "Edit permissions for a role",
34
"type": 1
35
}
36
]
37
}
38
]
39
}]`
40
});

Preview of the Example

discord

Replying to Sub commands/groups

You can filter sub_command_groups directly in the command options.

1
<client>.interactionCommand({
2
name: "moderation",
3
sub_command_group: "user"
4
prototype: "slash"
5
code: ...
6
})

This would only make the bot reply to the “user” sub-command-group, you can return the sub-command-group with $interactionData[options._group].