Permalink
Fetching contributors…
Cannot retrieve contributors at this time
190 lines (134 sloc) 4.65 KB

Services

This is the documentation for the individual services that come with ZenIRCBot. For all of the Node.js based services you'll need to have the node redis library installed. For the Python based services you'll need to need to have the python redis library installed:

$ npm install redis # for Node

$ pip install redis # for Python

Admin

This is a service for doing basic things like starting and stopping other services or restarting the bot. You'll need to also have semantics running as it provides the directed_privmsg type that admin.js relies on. It is written in Node.js and also relies on forever:

$ npm install forever

Config

The config is very simple, a single option called services which is a list of services you want started when you start admin.js

Commands

start <service name>
This will start the specified service.
restart <service name>
This will restart the specific service.
stop <service name>
This will restart the specific service.
pull
This will pull down new code.

Github

This service relies on the weblistener service to pass along the post body with the service set in the JSON envelope. It is written in Node.js

Jira Feed

This service does a check on the specified JIRA issue RSS feed and posts to the channel whenever an issue is created, closed, or reopened. It is written in Python.

Jira Ticket

This service watches for something formated with 2 letters, a dash, then numbers. For example BH-1234, it takes that, and appends it to the specified JIRA URL and says it back to the channel so you get links to issues automatically. It is written in Node.js.

Release

This service is akin to the github service in that it relies on the weblistener service to send it data when something is posted to the port on the machine running the weblistener service. The post body should look like:

payload: "{
    branch: 'feature/cool_stuff',
    status: 'started',
    hostname: 'staging-04',
}"

Where payload is the post variable, and what it contains is a JSON string with the attributes branch, status, and hostname. And it will then emit something like:

release of feature/cool_stuff started on staging-04

To the channel specified in the config. It is written in Node.js.

Semantics

This service adds another message type that is sent out over in which is the directed_privmsg type. These are messages that have been determined to have been sent to the bot via the following two forms:

ZenIRCBot: commands
!commands

It will also grab messages that were sent directly to the bot via a PM. It sends the standard envelope like the privmsg type. Its data attribute is slightly different though:

"data": {
    "raw_message": "!commands",
    "message": "commands",
    "sender": "Wraithan",
    "channel": "#pdxbots"
}

It strips the the way it was determined to be addressed to the bot so you can listen specifically for commands to come through rather than having to check all possible methods for a person to send a direct message. It is written in Node.js.

Troll

This service is a basic trolling service. It is written in Node.js.

Commands

ls
Responds with a funny picture.
irssi
Responds with a suggestion to use weechat.

TWSRS

That's What She Really Said

This is a service inspired by talkbackbot and steals its quote DB which it got a lot of from this quote source.

Commands

That's what she said
Responds with a quote from a famous woman when this is said in a channel.
twsrs
This is an actual command and allows one to get quotes without having to say that's what she said.

Weblistener

This is a service that passes along post data to the web_in channel in redis in the format of:

body: {
    payload: "JSON String",
    app: 'whatever-path-on-the-url-posted-to',
}

Where payload is the POST body and app is http://example.com/whatever-path-on-the-url-posted-to for example. It is written in Node.js and also relies on having express installed:

$ npm install express