iBot is a
mods module for a very lightweight, minimal, and extensible IRC client framework
iBot is a
mods module for a very lightweight, minimal, and extensible IRC client framework.
$ npm install mods$ npm install mods-config
$ npm install ibot
Using iBot, it's very easy to create a minimal bot.
var mods = newrequire'mods'modsload'mods-config'modsload'ibot'
You probably want iBot to do more than, well, nothing, so it's a good idea to install
$ npm install ibot-essentials
In this example, iBot shows data sent/received, responds to server PINGs, and automatically joins some channels on connect.
var mods = newrequire'mods'modsload'mods-config'modsload'ibot'modsload'ibot-essentials/mods/core'modsload'ibot-essentials/mods/output'modsload'ibot-essentials/mods/ping'modsload'ibot-essentials/mods/autojoin'
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.
exportsname = 'greet'ifmessageopcode === 'JOIN'serversend'PRIVMSG ' + messageparams0 + ' :Welcome, ' + messageprefixnick + '!!'
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.
exportsname = 'cmd_ping'privmsgreply'Pong!'
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.