Class: Bot

Bot

new Bot(message_obj)

Represent a bot in a cluster.
Parameters:
Name Type Description
message_obj Message
Author:
Source:

Members

(private, inner) lock_master_ping :boolean

Controls the pinging of master
Type:
  • boolean
Source:

Methods

getBotData()

Fetches and then resets the bot data.
Source:

startBot(force_mode)

Starts the bot
Parameters:
Name Type Description
force_mode boolean Whether to start bot with force mode or not.
Source:

stopBot(fn)

Stops the bot and resets queues, buckets and cache status.
Parameters:
Name Type Description
fn function callback
Source:

updateStats(key, value)

Updates a stat value by given value.
Parameters:
Name Type Description
key String
value String
Source:

(private, inner) botInfoUpdater(updateConfig, fn)

Updates the stats in the db
Parameters:
Name Type Description
updateConfig boolean to update config or not
fn function callback
Source:

(private, inner) checkIfActiveBot(fn)

Checks if an active bot with same name is present return true if you can start the bot return false if an instance of the same bot name is running.
Parameters:
Name Type Description
fn function
Source:

(private, inner) msg()

Used to call Logger object with the caller function name.
Source:

(private, inner) pingMaster()

Tests if master is active by pinging from cluster network. If master fails it clears semaphore collection to start re-elect.
Source:

(private, inner) resetBotStats()

Resets the stats whenever stats are flushed into db.
Source: