1.0.1 • Published 9 years ago

basicbot v1.0.1

Weekly downloads
3
License
UNLICENSED
Repository
github
Last release
9 years ago

Basicbot

Basicbot for our internal bot swarm. Requires an options objection with commands in it.

Bots require a SLACK_TOKEN env variable. Please pass this or declare it before initializing the bot.

Requires slack-client

Usage:

//Require the basicbot package - Usage is as a singleton.  
var basicbot = require('basicbot');

//Fly in your options for the bot (expects a cmds parameter)
var botoptions = require('./lib/botoptions');

//Initialize the bot
basicbot(botoptions);

Options:

var options = {
	cmds: {
		projects: require("./lib/projects"),
		groups: require("./lib/groups"),
		issues: require("./lib/issues")
	}
}

Commands

var projects(words, callback) {
	if (words[2] === 'destroy'){
		callback('You can't destroy projects.  They destroy you');
	}
}

module.exports = projects;

Commands should be structured to recieve an array of words of the message recieved and pass a callback containing either:

  1. A string to be sent to the channel where the message was recieved.
  2. A well formed Slack message object which can contain attachments, etc. Form it cleanly and you'll have no problems. Even a single attachment passed as an attachments property needs to be in an array.

More info here: Slack Formatting Slack Attachments

Version 1.0.0 // Committed 9/2/2015

1.0.1

9 years ago

1.0.0

9 years ago