databaseWrapper

Wrapper for database functions, provides safety checks to some functions and automatically looks up the object linked to an ID for others

Source:

Members

(inner, constant) realExports :any

Source:

The actual exports of the file. Exports are assigned to module.exports after startup is completed

Type:
  • any

Methods

(async, inner) locateMessageMaps(SlackMessageID, textOnlyopt, messageLookupopt) → {Array.<Object>|Array.<Discord.Message>}

Source:

Will return an array of all maps. Selecting textOnly will return one or no results only

Parameters:
Name Type Attributes Default Description
SlackMessageID string

The id of a Slack message to look up

textOnly boolean <optional>
false

Whether to filter out message maps that don't contain the main text content

messageLookup boolean <optional>
true

Whether to automatically look up the message map on Discord

Returns:

Array of maps or Discord message objects. May be empty

Type
Array.<Object> | Array.<Discord.Message>

(async, inner) messageMap(passthroughObj) → {Promise.<void>}

Source:

Wrapper for databaseManager.messageMap. Adds error handling to messageMap to prevent the program from crashing after being unable to add an entry

Parameters:
Name Type Description
passthroughObj Object

Object to pass to databaseManager.messageMap

Returns:
Type
Promise.<void>

(async, inner) messageMapToMessage(map) → {Message|undefined}

Source:

Converts a Message Map into a Discord Message object

Parameters:
Name Type Description
map Object

Message map to look up

Returns:

Resolves to the located message or nothing if not found

Type
Message | undefined

(async, inner) startup(loggingGuild) → {Promise}

Source:

A function that resolves once the database and DiscordManager have successfully started up. Duplicate calls will result in no-ops
Must be called before using any other function exported by this file (Other functions are inaccessible until this resolves)

Parameters:
Name Type Description
loggingGuild Discord.Guild

Discord server/guild object

Returns:

Resolves once startup is complete and functions become accessible

Type
Promise