This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Miouns edited this page Dec 27, 2020
·
3 revisions
Welcome to the kurapika wiki!
to create a command you have to do..
- Create category in
commands
folder - Create file javascript in
commands/category
folder example
commands
└── general
└── test.js
- 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