Monitor are functions that are designed to watch incoming messages. These can range from
checking a message for specific words, or logging all mentions to a channel.
Example
They will always follow this structure.
exports.run = (client, msg) => { // code here };
exports.conf = {};
Members
-
static conf :Conf
-
An object that configures the monitor.
Example
exports.conf = { enabled: true, ignoreBots: true, ignoreSelf: true };
Methods
-
static run(client, msg)
-
The part of the monitor that will run on the message.
Parameters:
Name Type Description clientKomadaClient The Komada Client msgMessage A Message object obtained from discord.js Example
This will create a monitor that logs every message that mentions the bot.
exports.run = (client, msg, cmd) => { if (msg.mentions.users.has(client.user.id)) console.log(`Message ${msg.id} contained the bots mention: ${msg.cleanContent}`); }
Type Definitions
-
Conf
-
An Object containing configuration values that will configure a monitor.
Properties:
Name Type Description enabledBoolean Whether or not this monitor should be enabled for use. ignoreBotsBoolean Whether or not this monitor should ignore other bots. ignoreSelfBoolean Whether or not this monitor should ignore messages from the ClientUser.