Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An extensible Node.js bot for Campfire.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
LICENSE
README.md
config.js-dist
package.json
run.js

README.md

node-smores is no longer in active development. I recommend just using Github's Hubot instead as it's stable and has a very active community. https://github.com/github/hubot

node-smores

node-smores is a simple extensible bot for Campfire.

Requirements

Running node-smores

Copy config.js-dist over to config.js and edit in the appropriate values for your Campfire installation.

  • account is the domain of your account. So if your url is "smores.campfirenow.com", your account is "smores".
  • token is the API token of the user you want to act as your bot.
  • ssl is self-explanatory.

Run node-smores:

node run.js --room=ROOM

Note that --room accepts either the ID of your room, or its name. It's badass like that.

Plugins

node-smores is controlled via plugins in lib/plugins, and as such, has an easy to use plugin interface.

Plugins consist of a singular function with a command that consists of at least three variables:

  1. name - Name of the plugin.
  2. regex - Regex applied to messages to capture and execute this command. As of v0.2 this can be an array of regular expressions if your plugin requires multiple triggers.
  3. callback - Code to execute for this command.

The order of arguments for the callback are as such:

  • body - The regex matched message body
  • message - The message object as returned from the Campfire API.
  • room - The current room object as returned from node-campfire.
  • smores - The instance node-smores object.
  • config - (optional) As of v0.2 plugins can have their own configuration files so if your plugin requires its own configuration file (config.js), node-smores will dump the contents of that into this argument. If your plugin doesn't need any of that, this argument will not be present.

The following is a simple plugin to respond to "/ping" calls.

/**
 * node-smores plugin to respond to a ping.
 *
 */
function Command() {
  this.name = "/ping";
  this.regex = /\/ping/;
  this.description = "Respond to a ping.";
  this.callback = function(body, message, room, smores) {
    smores.speak('pong', room);
  }
};

exports.Command = Command;

Simple.

Mentions

Something went wrong with that request. Please try again.