Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
Miouns edited this page Dec 27, 2020 · 3 revisions

Welcome to the kurapika wiki!

Create Command

to create a command you have to do..

  1. Create category in commands folder
  2. Create file javascript in commands/category folder example
commands                                               
  └── general
       └── test.js
  1. Create a command code like this
const Discord = require("discord.js");
const { Command } = require("discord-akairo");

class TestCommand extends Command {
  constructor() {
    super("test", {
      aliases: ["test"],
      description: {
        content: "test command",
        usage: "test",
        example: ["test"]
      }
    })
  }
  exec(msg) {
    return msg.channel.send("The test command was executed successfully")
  }
}

module.exports = TestCommand;

Above is the most basic code for the test command. Let me explain...

  • Class NameCommand extends Command - This is so that the system knows that there is a command in this file
  • constructor() - yeah this is constructor
  • super("name", ...) - it's for the command name
  • super("name", { aliases: ["name", "aliases"] }) - In the aliases array at the very beginning you have to enter the name of the command, otherwise the command will not run
  • super("name", { description: { content: "this is description", usage: "this is usage", example: ["this is example in array"] } }) - This is the part where you describe your command
  • exec(msg, ...) { ... } - This is the part where you create how to get your code running
  • module.exports = NameCommand - This is the part where your file returns the command class

More details

Clone this wiki locally