Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.
/ node-corrade Public archive

Establishes a TCP and HTTPS connection to a corrade bot.

License

Notifications You must be signed in to change notification settings

aMidnightNova/node-corrade

Repository files navigation

Node Corade

Sorta like a brain for your Corrade bot.

How do I use?

That's a good question!

Info

Node Corrade is built using Promises everything should resolve or reject back to your main file.

Classes

Corrade

Members

REGISTERED_MODULES : Object

Object containing registered modules.

Corrade

Kind: global class

new Corrade(config)

Create an object that will interact with your corrade bot.

Param Type Description
config object Configuration options needed to establish a TCP connection with the corrade bot.
config.protocol string The protocol that you will use: http, https.
config.host string fqdn hostname or ip where the corrade bot is.
config.port number The port the tcp connection is on.
config.group string Second Life group name.
config.password string Second Life Corrade group password.
config.types array array of notification types you will subscribe to.
config.basicAuth object http basic auth credentials.
config.basicAuth.user string http basis auth username.
config.basicAuth.password string http basic auth password.

Example

let config = {};
config.host = 'bot.example.com';
config.protocol = 'https';
config.group = 'MyGroupHere';
config.password = 'SuperAwesomeStrongPassword';
config.basicAuth = {
    user: 'corrade',
    password: 'Somepassword'
};
config.port = 9000;
config.types = ['group', 'message', 'statistics'];


let Corrade = require('./corrade.js');
let corrade = new Corrade(config);

"line"

Snowball event.

Kind: event emitted by Corrade
Properties

Name Type Description
parsedDate string returns data that is emitted from the tcp Interface.

Corrade~query(options, autoEscape) ⇒ Promise

Kind: inner method of Corrade
Returns: Promise - parsedData - returns a promise object which will contain querystring parsed data, is csv format.

Param Type Description
options object case specific options needed to send a http(s) query to corrade.
autoEscape boolean querystring escape all contents of the options object.

Example

corrade.query({
    command: 'tell',
    entity: 'avatar',
    agent: '<agent uuid>',
    message: 'Some Text Here'
}, false);

Corrade~loadModules(modules, authorizedRoles, allowedTypes)

Kind: inner method of Corrade

Param Type Description
modules array array of modules to load.
authorizedRoles array array of authorized group roles from your second life group that have access to this module.
allowedTypes array notification types this belongs to.

Example

corrade.loadModules([ban], ['Staff', 'Owners'], ['message']);

Corrade~runModule(moduleName, params) ⇒ Promise

Kind: inner method of Corrade
Returns: Promise - returns a promise object which will contain the data of the registered function after it runs.

Param Type Description
moduleName string string name of the registered module.
params object object of data for the module to run.

Example

corrade.loadModules([ban], ['Staff', 'Owners'], ['message']);

Corrade~corradeGetGroupMembersByName(arrayOfNames) ⇒ Promise

Kind: inner method of Corrade
Returns: Promise - returns a promise object which will contain a csv of names unless any one of the names do not match.

Param Type Description
arrayOfNames array array of legacy names or partial names.

Example

corrade.corradeGetGroupMembersByName(['bunny','bob','sunny']).then(function (res) {
             //do things
         });

Corrade~corradeGetGroupMemberByName(singleName) ⇒ Promise

Kind: inner method of Corrade
Returns: Promise - returns a promise object which will contain the full name unless it does not match anyone in the group.

Param Type Description
singleName string single legacy name or partial name.

Example

corrade.corradeGetGroupMembersByName('bunny').then(function (res) {
             //do things
         });

Corrade~checkIfCommandAndReturnFormattedData(data) ⇒ Promise

expects the initial message from corrade (ater its been trasformed though querystring) to go into this function then formats the data to be more javascript friendly if the first part of the message string is a command.

Kind: inner method of Corrade
Returns: Promise - returns a promise object which will contain the firstName, lastName, messageAsString, messageAsArray, command, uuid, and type paramaters.

Param Type Description
data object corrade data object.

Example

corrade.corradeGetGroupMembersByName('bunny').then(function (res) {
             //do things
         });

REGISTERED_MODULES : Object

Object containing registered modules.

Kind: global variable

About

Establishes a TCP and HTTPS connection to a corrade bot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published