An extensible IRC bot written in node.js
- node-irc
- mongoose
First make sure you have node.js and npm installed, then from the root vertexbot directory, run:
git submodule update --init
If you don't have coffeescript installed, you can either install it globally by running:
npm install -g coffee-script
or locally for this project by running:
npm install
Now just copy example-config.coffee to config.coffee and replace the config options with their appropriate values. Note that some of the plugins may be irc server dependent (mostly freenode). See the documentation for each plugin in order to determine which will work on what network if you aren't sure. Finally, to start the bot run: coffee vertexbot.coffee
Plugins are fairly simple to develop, just write the plugin and drop it into the 'plugins/' folder. Plugins should export a list of objects under the events variable, and each object should have an action member that contains a string for what event to react to, and a reaction member function that contains what to do when that event occurs. See the log.coffee plugin for an example. If your plugin is more complex than something you want to put in a single file, place it in a directory and create a front end *script file for the bot to include. If you want the functionality to be available to many plugins, such as the database plugin, place it in the utils folder. Other plugins can require it from there. Again, see the log.coffee plugin for an example of something using a shared utility.
This is a list of the events emitted by the bot. Note that most of the commands are actually emitted from node-irc, so see there for further documentation on events.
function(sender, respondee, command, args)
Emitted when a command is issued to the bot. Commands are anything where the bot is directly told something, and the args is just a string with everything after the command issued. For example, the message "bot: do something awesome" would have the command "do" and the args "something awesome". The sender is the person who sent the message, and respondee is the place to send the response. If the message is sent in a channel, this will be the channel to respond in. If this was sent in a PM, it will be the nick of the person who sent it.
function(from, to, message)
Emitted when a message is sent in one of the channels the bot is currently residing in.
function(from, message)
Emitted when a message is sent to the specified channel.
function(motd)
Emitted when the connection to the IRC server is complete and the MOTD has been sent.
function(channel, nicks)
function(channel, topic, nick)
function(channel, nick)
function(nick)
function(channel, nick)
function(nick, reason)
function(nick, reason, channels)
function(channel, nick, by, reason)
function(nick,by,reason)
function(nick, to, text)
function(channel, nick)
function(oldnick, newnick, channels)
function(message)
function(message)