0.8.0 • Published 10 years ago

ibot v0.8.0

Weekly downloads
119
License
Apache-2.0
Repository
github
Last release
10 years ago

iBot Framework

iBot is a mods module for a very lightweight, minimal, and extensible IRC client framework.

Dependencies

$ npm install mods
$ npm install mods-config

Usage

Installation

$ npm install ibot

Quick Start

Using iBot, it's very easy to create a minimal bot.

index.js
var mods = new(require('mods'))
mods.load('mods-config')
mods.load('ibot')
config.json
{
  "ibot": {
    "servers": {
      "example": {
        "host": "irc.example.com",
        "port": 6667,
        "ssl": false,
        "nick": "iBot",
        "user": "ibot"
      }
    }
  }
}

Essentials

You probably want iBot to do more than, well, nothing, so it's a good idea to install ibot-essentials.

$ npm install ibot-essentials

In this example, iBot shows data sent/received, responds to server PINGs, and automatically joins some channels on connect.

index.js
var mods = new(require('mods'))
mods.load('mods-config')
mods.load('ibot')
mods.load('ibot-essentials/mods/core')
mods.load('ibot-essentials/mods/output')
mods.load('ibot-essentials/mods/ping')
mods.load('ibot-essentials/mods/autojoin')
config.json
{
  "ibot": {
    "servers": {
      "example": {
        "host": "irc.example.com",
        "port": 6667,
        "ssl": false,
        "nick": "iBot",
        "user": "ibot"
      }
    }
  },
  "ibot_autojoin": {
    "channels": [
      "#ibot",
      "#programming",
      "#self-learning-for-dummies"
    ]
  }
}

Example Module

This is an example mods module that greets users who join a channel. There's room for improvement but it's not meant to be perfect; just to show what an iBot module looks like.

greet.js
exports.name = 'greet'
exports.ibot$recv = function(server, message)
{
	if(message.opcode === 'JOIN')
	{
		server.send('PRIVMSG ' + message.params[0] + ' :Welcome, ' + message.prefix.nick + '!!')
	}
}

Commands

This is an example module that hooks a command event from cmd and provides a simple ping command. Note that ibot-essentials/mods/cmd needs to be loaded into mods in order for commands to receive events.

cmd_ping.js
exports.name = 'cmd_ping'
exports.ibot_cmd$cmd_ping = function(server, privmsg, command)
{
	privmsg.reply('Pong!')
}

Why?

iBot doesn't have a module system, nor does it have a config system. It doesn't include any modules either. Versions of iBot before v0.7.0 did. So, why not?

The module and config systems in previous versions of iBot were completely rewritten as generic, self-contained systems which can be used in any project (not just iBot). This means that the most important part of iBot - the iBot framework itself - is very concise and lightweight, and can be used without any module system or config system if desired. Additionally, it means that the config system it does use can be swapped out with another config system entirely.

0.8.0

10 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.7

10 years ago

0.6.6

11 years ago

0.6.5

11 years ago

0.6.4

11 years ago

0.6.3

11 years ago

0.6.2

11 years ago

0.6.1

11 years ago

0.6.0

11 years ago

0.5.10

11 years ago

0.5.9

11 years ago

0.5.8

11 years ago

0.5.7

11 years ago

0.5.6

11 years ago

0.5.5

11 years ago

0.5.4

11 years ago

0.5.3

11 years ago

0.5.2

11 years ago

0.5.1

11 years ago

0.5.0

11 years ago

0.4.1

11 years ago

0.4.0

11 years ago

0.3.8

11 years ago

0.3.7

11 years ago

0.3.6

11 years ago

0.3.4

11 years ago

0.3.3

11 years ago

0.3.2

11 years ago

0.3.1

11 years ago

0.3.0

11 years ago

0.2.10

11 years ago

0.2.9

11 years ago

0.2.8

11 years ago

0.2.7

11 years ago

0.2.6

11 years ago

0.2.5

11 years ago

0.2.4

11 years ago

0.2.3

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.11

11 years ago

0.1.10

11 years ago

0.1.9

11 years ago

0.1.8

11 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.1

11 years ago