Class: CoolPal

CoolPal(config)

CoolPal is a bot for Discord with plugins.

Constructor

new CoolPal(config)

Create your pal.
Parameters:
Name Type Description
config Object The high level configuration object for CoolPal.
Properties
Name Type Description
token string A token for the Discord API.
plugins Array.<Object> Plugins to enable.
Properties
Name Type Description
name string The name of a plugin.
configuration Object Configuration specific to the plugin.
Source:
Example
// Copy the plugin configuration file from examples and fill in API keys
// and the Discord API token
fs.readFile('path/to/your/configuration/file.json', (err, data) => {
  if (err) {
    throw err;
  }

  let configuration = JSON.parse(data);

  let pal = new CoolPal(configuration);
  pal.start();
});

Members

client :Object

A Discord API client.
Type:
  • Object
Source:

config :Object

The high level configuration object for CoolPal.
Type:
  • Object
Source:

discord_token :Object

A Discord bot API token.
Type:
  • Object
Source:

plugins

Return a list of plugins
Source:
Example
// Iterate over the plugins
for (let plugin of pal.plugins) {
  console.log(plugin.command)
}

prefix :Array.<Object>

The prefix for all plugin commands.
Type:
  • Array.<Object>
Source:

Methods

start()

Starts the event loop.
Source:
Example
let pal = CoolPal({
  token: process.env.DISCORD_TOKEN,
  plugins: []
});
pal.start();