Skip to content

CommandService.create()

github-actions[bot] edited this page Sep 30, 2024 · 2 revisions

creates slash commands
type: Function

arguments:

  • name/data String/Object: first argument can either be the name or an object with data
  • ?description String
  • ?options Array
  • ?nsfw Boolean
  • action Function: it'll always grab the last argument as the action

returns:

  • context: interaction and info for the command

commands.create("test1", "first test command", (ctx) => {
    ctx.reply("this is a test command!");
});



commands.create({ name: "test2", desc: "second test command"}, (ctx) => {
    ctx.reply("this is a test command!");
});



let options = [{ name: "user", desc: "a user", type: "user", required: true }];



command.create("test3", "third test command", options, (ctx) => {
    let userId = ctx.args[0].value;
    ctx.reply(`Hi <@${userId}>!`);
});



commands.create({ name: "test4", desc: "fourth test command", options: options }, (ctx) => {
    let userId = ctx.args[0].value;
    ctx.reply(`Hi <@${userId}>!`);
});


🛈 Client

🛈 AddonService

🛈 AttachmentService

🛈 ChannelService

🛈 CommandService

🛈 ComponentService

🛈 ErrorService

🛈 EventService

🛈 ExpressionService

🛈 GuildService

🛈 LogService

🛈 MessageService

🛈 PermissionService

🛈 RoleService

🛈 StorageService

🛈 TypeService

🛈 UserService

🛈 UtilService

🛈 VoiceService


Clone this wiki locally