Communication

Communication

Get information depending the client communication. Checkers to keep communication on the wanted channels

Constructor

new Communication(message)

Parameters:
Name Type Description
message * The discord.js message object which was received.
Properties:
Name Type Description
message Object The discord.js communication object to be used.
storage Object The active storage
defaults Object Responses for default cases invalid channel, ...
category * Configuration of categories to be used for communication.
member * Configuration of channels to be used by members
admin * Configuration of channels to be used by admins
Version:
  • 1.0
Author:
  • Maksim Sandybekov
Source:

Methods

isAllowed(admin) → {boolean}

Check if the communication over given channel name and category is allowed, for member/admin users. Category configuration allows for string or array of strings. Member configuration allows for string, array of strings or array of objects with {"name": "string", "category": "string"} Admin configuration allows for string, array of strings or array of objects with {"name": "string", "category": "string"}
Parameters:
Name Type Default Description
admin boolean false If the communication is for admins only
Source:
To Do:
  • Check for admin role instead if no channel/category is configured

getDefaults(name) → {string}

Retrieved the response from the _default_ section inside the definition file and replace template sequences of form {} by given additional parameters.
Parameters:
Name Type Description
name string Retrieve key to be used for the definition file.
Source:
Examples
getDefaults("wrongChannel", userId, channelName);
getDefaults("directMessage", userId);

isDirect(message) → {boolean}

Check if message received was direct a message.
Parameters:
Name Type Description
message * A discord.js message object
Source:
Example
isDirect();

getReason(message, admin) → {string}

Get a response message giving a reason why communication over channel used by the user is not possible.
Parameters:
Name Type Description
message Object The received discord.js message object
admin boolean Indicator to check for admin or member channel
Source:

getUserId() → {number}

Retrieve and return the id of the user.
Source:

getGuildId() → {number}

Retrieve and return the guild from the message object.
Source:

getChannel() → {string}

Retrieve and return the channeln name of the current message.
Source:

getCategory() → {string}

Retrieve and return the category name of the current message.
Source:

getChannelConfig(admin) → {*}

Retrieve the current channel configuration.
Parameters:
Name Type Default Description
admin boolean false
Source:

getCategoryConfig() → {*}

Retrieve the current category configuration.
Source:

setChannelConfigs()

Setup server specific channel configuration for bot communication.
Source:

setDefaultMember()

Set default channel configuration for member channels.
Source:

setDefaultAdmin()

Set default channel configurations for admin channels.
Source:

setDefaultCategory()

Set default channel configuration for the category of channels.
Source: