CommandService.create() - shysolocup/noscord.js GitHub Wiki

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}>!`);
});


⚠️ **GitHub.com Fallback** ⚠️