Commands

Command Groups

Command groups allow you to organize related commands together. For example, you might have a group called "mod" that contains commands like "kick", "ban", and "mute".

Creating a Command Group

Creating a command group is simple:

Create a Folder

Create a new folder inside src/commands/ to group your related commands.

Add index.ts

Create an index.ts file inside your folder and define the group using the Command class.

src/commands/folder/index.ts
import { Command } from "@/classes/command";

export default new Command({
  name: "",
});

The name property must be left blank (""). Unlike actual commands, the name will be inferred from the folder name.

Add Commands

Add your command files in the same folder. They will automatically be grouped.

Inheritance

Command group settings cascade down through subgroups. Each level can override settings from its parent.

index.ts
joke.ts
index.ts
meme.ts
import { Command, PermissionLevel } from "@/classes/command";

export default new Command({
  name: "",
  aliases: ["funny", "entertainment"],
  permission: PermissionLevel.User, // All fun commands require user permission
  cooldown: 5, // All fun commands have a 5 second cooldown
});
  • joke command: cooldown 5s, User permission (from fun group)
  • meme command (in fun/image): cooldown 2s, User permission (from fun group's permission)

Properties

Command groups use the same properties as the Command class.

Prop

Type

On this page