Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
FatBot is an easy to use and extensible coffeescript IRC bot framework
tag: v0.2.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

    ______      __  ____        __ 
   / ____/___ _/ /_/ __ )____  / /_
  / /_  / __ `/ __/ __  / __ \/ __/
 / __/ / /_/ / /_/ /_/ / /_/ / /_  
/_/    \__,_/\__/_____/\____/\__/  

FatBot is an easy to use and extensible coffescript IRC bot framework.

NOTE : This is used as specs for now. This is still a draft at some points.

Quick start

Here is an example of a simple hello bot :

{Fatbot} = require 'fatbot'

bot = new Fatbot
  server: 'freenode',
  username: 'fatbot',
  channels: ['#fatbot']

# The refinery helper `hear` is built-in
bot.refinery.hear /hello/, (msg) ->
  msg.reply "Hello #{} !"


Then launch your bot :

coffee mybot

Build from sources

To build from sources, clone this repo :

git clone

Then from the repo root folder, install the dependencies :

npm install

You can now create your bot or try one frome the example in the folder ./bots/

Use cake task bot:start to start a bot :

cake -b simple bot:start

Here we are starting the example bot called


Sugars are behaviors. For example, saying hello to a user that connects to a channel. Sugars are object literals that contains multiple parameters :

Parameter Required Arguments Description
`on` true String event When to trigger the callback
`do` true Function callback(Message msg) What to do when event occurs
`if` false Function boolean(Message msg) This have to be null or true for the callback to be executed

Here is a sugar on top of hear built-in refinery helper that says hello to a user that says 'hello' :

bot.refinery.hear /hello/, (msg) ->
  msg.reply "Hello #{} !"

To build a sugar without passing by a refinery helper, just call Fatbot.prototype.sweeten method and return a sugar-structured object :

  on: 'user:connect'
  if: (msg) ->
    msg.username isnt 'fatbot'
  do: (msg) -> "Welcome on #{}, #{msg.username} !",


The refinery is a sugar factory, it offers several methods (helpers) that create sugars quickly, with it's own logic. This will help create inline or complex sugars with less code (look at the hear example)

Here is a refinery helper to test a regex on user:message event :

module.export.hear = (regex,callback) ->
    sugar =
      on: 'user:talk'
      do: callback
      if: (msg) ->
        msg.match = msg.message.match regex
        if msg.match
          msg.reply = (txt) ->
            console.log "replying #{txt} in #{}"
          return true
          return false


These are the events thrown by the IRC interface (@account)

Event name Description Parameters
`self:connected` Bot is connected to server {String server}
`self:talk` Bot is talking {String author, String channel, Object account}
`self:join` Bot is joining a channel {String channel, String username, Object message, Object account}
`user:talk` User is talking in channel {String author, String channel, Object message, Object account}
`user:private` User send pm to the bot {String author, String channel, Object message, Object account}
`user:join` User join a channel {String channel, String username, Object message, Object account}

Change log

2012-12-24 v0.2.0

  • Bot completely rewritten in coffeescript on top of node and node-irc
  • Fatbot is now a standalone framework
  • Plugins are now called sugars
  • Added sugars factories called refinery helpers
  • Merge of node branch into master
  • Fist beta working version of the coffeescript version
Something went wrong with that request. Please try again.