Skip to content
sern

commandModule

commandModule(mod): Module

Creates a command module with standardized structure and plugin support.

Parameters

mod: InputCommand

Command module configuration

Returns

Module

Processed command module ready for registration

Since

1.0.0

Example

1
// Basic slash command
2
export default commandModule({
3
type: CommandType.Slash,
4
description: "Ping command",
5
execute: async (ctx) => {
6
await ctx.reply("Pong! 🏓");
7
}
8
});

Example

1
// Command with component interaction
2
export default commandModule({
3
type: CommandType.Slash,
4
description: "Interactive command",
5
execute: async (ctx) => {
6
const button = new ButtonBuilder({
7
customId: "btn/someData",
8
label: "Click me",
9
style: ButtonStyle.Primary
10
});
11
await ctx.reply({
12
content: "Interactive message",
13
components: [new ActionRowBuilder().addComponents(button)]
14
});
15
}
16
});

Source

src/core/modules.ts:47