Class: Plugin

Plugin(configopt)

Plugin is an abstract class providing an interface for consuming Discord events.

Constructor

new Plugin(configopt)

Parameters:
Name Type Attributes Default Description
config Object <optional>
{} The optional configuration for a plugin.
Source:

Members

command :string

The base command a user types to access this plugin.
Type:
  • string
Source:

supported_event_types :Array.<string>

A list of events implemented. The only supported event type right now is message.
Type:
  • Array.<string>
Source:

Methods

handle_event(event_type, event, config)

Maps an event type to a handler for the plugin. The only supported event
Parameters:
Name Type Description
event_type string A Discord API supported event type.
event Object An event from the Discord API.
config Object Configuration from a CoolPal instance.
Properties
Name Type Description
prefix string The prefix for a command. Default is '!'.
client Object A Discord client instance.
Source:
To Do:
  • Implement more event types
  • Deprecate passing in a config for a member variable called 'pal' that offers the same functionality

handle_message(event, config) → {bool}

Abstract method for handling the message event. The plugin extending this class is responsible for returning true if the message was handled, and false otherwise.
Parameters:
Name Type Description
event Object An event from the Discord API.
config Object Configuration from a CoolPal instance.
Properties
Name Type Description
prefix string The prefix for a command. Default is '!'.
client Object A Discord client instance.
Source:
To Do:
  • Deprecate passing in a config for a member variable called 'pal' that offers the same functionality
Returns:
false
Type
bool

prefixed_command()

Source: