NGINB

NGINB

NGINB - A Rivescript-Node engine to make bots interaction with Facebook Messenger and Databases easier
Version:
  • 0.1.5
Author:
Source:

Methods

addEventListener(listener, callback)

Adds an event listener to the bot messenger controller
Parameters:
Name Type Description
listener String A string with one of the listeners:
FinishFacebookMessageDispatch
FinishAllFacebookMessageDispatch
FinishMessageDispatch
FinishAllMessageDispatch
HandleCustomMessageReplyItems
callback function The function to be called on event
Source:

configure(options)

Configures the bot instance, if you need to change something after the instance is created
Parameters:
Name Type Description
options BotOptions Bot options object
Source:

dispatchDirectMessage(message, event) → {Object}

Dispatch a message without pass to the bot's brain
Parameters:
Name Type Description
message Object An object (The "text" key is required)
event Event An event object
Source:
Returns:
A bluebird promisse response
Type
Object

dispatchEvent(event) → {Object}

Dispatch an event, can dispatch diretctly or using a bot
Parameters:
Name Type Description
event Event An event object
Source:
Returns:
A bluebird promisse response
Type
Object

getBotController() → {Bot_Controller}

Gets the bot controller used in this instance
Source:
Returns:
A bot controller
Type
Bot_Controller

getBotResponse(event) → {Object}

Sends a message diretctly to the bot
Parameters:
Name Type Description
event Event An Event object sent by facebook controller
Source:
Returns:
A bluebird promisse response
Type
Object

getFacebookController() → {Facebook_Controller}

Gets the facebook controller used in this instance
Source:
Returns:
A facebook controller
Type
Facebook_Controller

getMenuController() → {Menu_Controller}

Gets the menu controller used in this instance
Source:
Returns:
A menu controller
Type
Menu_Controller

getPageController() → {Page_Controller}

Gets the page controller used in this instance
Source:
Returns:
A page controller
Type
Page_Controller

getUserController() → {User_Controller}

Gets the user controller used in this instance
Source:
Returns:
An user controller
Type
User_Controller

sendMessageEvent(event, user_data) → {Object}

Sends a message to messenger
Parameters:
Name Type Description
event Event An event object
user_data Object If you have a previous loaded userdata, you can send it here
Source:
Returns:
A bluebird promisse response
Type
Object

setEntities(entities, lang) → {Object}

Sets the entities as subs to be used by rivescript
Parameters:
Name Type Description
entities Array.<EntityConfig> An object to be transformed to subs in rivescript - see: https://github.com/tostegroo/rivescript-nginb-js/blob/master/template-files/entities.js
lang String The brain language to be used to fill the subs
Source:
Returns:
A bluebird promisse response
Type
Object