Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 57 lines (37 sloc) 1.957 kb

vbotjr

vbotjr was originally made as a replacement for v8bot (http://github.com/eisd/v8bot). Over time the IRC library progressed to not be so buggy and added support for listeners and commands.

API

The underlying IRCBot library has methods which make it easy to add functionality.

Bot(profile)

@profile: An array of objects representing each server to connect to.

This is the main constructor for the bot. It is suggested that you inherit from this object when creating your bot, but you don't have to.

A profile is an array of objects. Each object has the properties:

  • host: The domain name or IP of an IRC server to connect to. Default: "localhost"
  • port: A port number. Default: 6667.
  • nick: A string nick name to try to connect as. Default: "guest"
  • password: The password used to connect (This is not NickServ). Default: null
  • user: Your IRC username
  • real: Your 'real name' on IRC
  • channels: An array of channel names to connect to. (e.g. ["#stuff", "##mychannel", "#yomama"])

this.init()

Goes through each server in the profile and begins connecting and registering event listeners.

this.register_listener(regex, callback)

Adds a regular expression listeners to incoming traffic on all servers. When the messages match, callback is called with the arguments:

  • context: A context object
  • text: The full message
  • 1st subpattern
  • 2nd subpattern
  • ...

this.register_command(command, callback, options)

Adds a command.

  • command: A string value for the command
  • callback: A function to call when the command is run
  • options: An object with the keys: allow_intentions and hidden.

When the command is called, the callback is called with the arguments:

  • context: A context object
  • text: The command arguments

Additional Documentation

This bot AND/OR bot library is still being developed, but those are some of the basic commands. Look at ecmabot.js for an example usage.

Something went wrong with that request. Please try again.