Extendable

Extendables allow you to "extend" native Discord.js classes with functions that you can use.
Example

They will always follow this structure.

exports.extend = function() { // code here };
exports.conf = {};

Members

static conf :Conf

An object that configures the extendable.
Example

When applied to Message, this would be accessed via .ping();

exports.conf = {
   type: "method",
   method: "ping",
   appliesTo: ["Message"],
   komada: false
 };

Methods

static extend()

The part of the extendable that is added to the class.
Example

This will create an extendable that replies to the author of the message with "Pong!"

exports.extend = function() {
  return this.reply("Pong!"); // The keyword 'this' refers to a Message Object.
}

Type Definitions

Conf

An Object containing configuration values that will configure an extendable.
Properties:
Name Type Description
type String Type of extendable. This will be one of the three: "method", "set", or "get".
method String The name of this extendable.
appliesTo Array An array of Discord.js classes that this extendable will apply to.
komada boolean Whether or not this extendable should apply to Komada or Discord.js