Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An IRC bot written from scratch in node.js
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
README.md
config.dist.json
core-handlers.js
create-msg.js
create-parser.js
index.js
irc-stream.js
package.json

README.md

ICARUS BOT

Icarus

This is a very simple IRC bot that I built from scratch because I wanted to learn about RFC 2813

Creating a bot:

  • npm install icarusbot
  • npm install any plugins you want.
  • Copy node_modules/icarusbot/config.dist.json to node_modules/icarusbot/config.json TODO: Fix that, updates break config.
  • Fill out all the stuff in config.json
  • Write a bot consumer:

    var bot = require('icarusbot')
    var pluginFoo = require('icarubot-plugin-foo')(bot)
    var pluginBar = require('icarubot-plugin-bar')(bot)
  • Run your bot node whatever-you-name-your-bot.js

Creating a plugin:

The bot currently emits various events that you can listen to, most notably the msg event.

Here is a simple plugin:

module.exports = function(bot) {
  bot.on('msg',function(msg) {
    console.log(msg) // {sender: 'a_nick', chan: '##foo', msg: 'foo bar baz'}

    // bot.msg() supports writing messages in a sane way.
    if (msg.msg === 'wow') {
      bot.msg(['#channel1', '#channel2'], 'mom')
    }
  })
}

Current plugins (PR to add yours!):

  • icarusbot-lysergix:

    • Adds a handler for a !face message that posts a random face from lysergix-api
  • icarusbot-reddit:

    • Adds a !r command that accepts a subreddit and optionally an nth latest post and returns the title and link of the post.
  • icarusbot-twitter:

    • Adds !tw command with various subcommands to interact with twitter.
  • icarusbot-coinflip:

    • Adds a !flip command for when you just can't make up your mind.
Something went wrong with that request. Please try again.