Command

Commands are pieces of code ran when messages contain the bots prefix. Along with these, we have a full argument parsing system for use in commands.
Example

They will always follow this structure

exports.run = async (client, msg, ...args) => { // code here };
exports.help = {};
exports.conf = {};

Members

static conf :Conf

An object that configures the command.
Example
exports.conf = {
   enabled: true,
   runIn: ["text", "dm", "group"],
   aliases: [],
   permLevel: 0,
   botPerms: [],
   requiredFuncs: [],
   requiredSettings: [],
 };

static help :Help

The help object used throughout komada
Example
exports.help = {
   name: "ping",
   description: "Ping/Pong command. I wonder what this does? /sarcasm",
   usage: "",
   usageDelim: "",
 };

Methods

static run(client, msg, args) → {Promise}

The part of the command that will run. This should always return a Promise to prevent issues in Komada. The easy way to do this is to add the async keyword.
Parameters:
Name Type Description
client KomadaClient The Komada Client
msg Message A Message object obtained from discord.js
args Array An array of arguments passed through by our argument parser.
Returns:
Promise
Examples
exports.run = (client, msg) => msg.reply("Hello Komada!");
exports.run = async (client, msg) => {
 const message = await msg.channel.send("Hello!");
 return message.edit("Hello from Komada!");
}
exports.run = async function run(client, msg) {
 const message = await msg.channel.send("Hello!");
 return message.edit("Hello from Komada!");
}

Type Definitions

Conf

An Object containing configuration values that will configure a command.
Properties:
Name Type Description
enabled Boolean Whether or not this command should be enabled for use.
runIn Array What type of text channels this command should run in.
aliases Array An array of names that will also trigger this command.
permLevel Number What permission level this command should be limited to.
botPerms Array What permissions the bot must have to run this command.
requiredFuncs Array What functions are required in the bot to run this command.
requiredSettings Array What settings are required in the default schema to run this command.

Help

An object containing help information that will help identify and use a command.
Properties:
Name Type Description
name String The name of the command
description String The description displayed in the help
usage String A usage string that denotes how the command should be used.
usageDelim String A character(s) to split the message content by and determine arguments.