Commands - MikalMirkas/beep-bot GitHub Wiki

Command Structure

There are two parts to every command file:

  1. exports.run
  2. exports.command

.run

.run contains your logic for the command. It should always terminate with a message being sent, to confirm that the command was accepted.

exports.run = (client, message, args) => {
	message.reply("this is a test");
}

A generic template for new commands is as follows:

exports.run = async (client, message, args) => {
    const arguments = require('yargs-parser')(args, {
        alias: {
            //arg stuff here
        }
    });

    message.channel.startTyping();
    //stuff here
    message.channel.stopTyping();

.command

.command contains an object with some data of the command.

exports.command = {
    "alias": "imageboard",
    "description": "Returns an SFW image from a booru."
}