coffea / 0.3.5 last updated a year ago created on Mar 31st 2014

Install

npm install --save coffea

Clone

git clone git@github.com:caffeinery/coffea.git

dependencies show all 6

main irc-replies 2.0.0 MIT
node-emoji 0.1.0 MIT
slate-irc-parser 0.0.2 MIT
underscore 1.6.0 MIT

maintainers

omnidan

versions 12 total

0.3.5 a year ago omnidan
0.3.4 a year ago omnidan
0.3.3 a year ago omnidan
0.3.2 a year ago omnidan
0.3.1 a year ago omnidan
0.3.0 a year ago omnidan
0.2.1 a year ago omnidan
0.2.0 a year ago omnidan
0.1.3 2 years ago maddin
0.1.2 2 years ago maddin
0.1.1 2 years ago maddin
0.1.0 2 years ago maddin
2 Downloads yesterday.

readme

Coffea Build Status Code Climate

event based and extensible irc client library with multi-network support

API

The outdated (but currently more complete) version of the API is available in the wiki).

We are working on an up-to-date version on another page in the wiki.

Examples

Normal Connection (Single network)

var client = require('coffea')({
    host: 'irc.freenode.org',
    // port: 6667, // default value: 6667
    // nick: 'test', // default value: 'coffea' with random number
    // username: 'test', // default value: username = nick
    // realname: 'test', // default value: realname = nick
    // pass: 'sup3rS3cur3P4ssw0rd' // by default no password will be sent
    // nickserv: {
    //     username: 'test',
    //     password: 'l33tp455w0rD'
    // }
});

client.on('motd', function (motd) {
    client.join(['#foo', '#bar', '#baz']);
});

client.on('message', function (event) {
    console.log('[' + event.channel.getName() + '] ' + event.user.getNick() + ': ' + event.message);
    //[#foo] nick: message
});

Multiple networks

var client = require('coffea')([
    {
        host: 'irc.freenode.org',
        name: 'freenode', // this is not required but recommended when dealing with multiple networks, by default a numeric id will be assigned
        // port: 6667, // default value: 6667
        // nick: 'test', // default value: 'coffea' with random number
        // username: 'test', // default value: username = nick
        // realname: 'test', // default value: realname = nick
        // pass: 'sup3rS3cur3P4ssw0rd' // by default no password will be sent
        // nickserv: {
        //     username: 'test',
        //     password: 'l33tp455w0rD'
        // }
    },
    {
        host: 'irc.oftc.net',
        name: 'oftc', // this is not required but recommended when dealing with multiple networks, by default a numeric id will be assigned
        // port: 6667, // default value: 6667
        // nick: 'test', // default value: 'coffea' with random number
        // username: 'test', // default value: username = nick
        // realname: 'test', // default value: realname = nick
        // pass: 'sup3rS3cur3P4ssw0rd' // by default no password will be sent
        // nickserv: {
        //     username: 'test',
        //     password: 'l33tp455w0rD'
        // }
    }
]);

// note how we are passing the network here, by default it'll just send to all networks
// by using network you can join specific channels on specific networks
client.on('motd', function (motd, network) {
    client.join(['#foo', '#bar', '#baz'], network);
});

client.on('message', function (event) {
    console.log('[' + event.network + '][' + event.channel.getName() + '] ' + event.user.getNick() + ': ' + event.message);
    //[freenode][#foo] nick: message
});

Using SSL

var client = require('coffea')({
    host: 'irc.freenode.org',
    ssl: true,
    // port: 6697, // will default to 6697 on ssl
    // nick: 'test', // default value: 'coffea' with random number
    // username: 'test', // default value: username = nick
    // realname: 'test', // default value: realname = nick
    // pass: 'sup3rS3cur3P4ssw0rd' // by default no password will be sent
    // nickserv: {
    //     username: 'test',
    //     password: 'l33tp455w0rD'
    // }
});

client.on('motd', function (motd) {
    client.join(['#foo', '#bar', '#baz']);
});

client.on('message', function (event) {
    console.log('[' + event.channel.getName() + '] ' + event.user.getNick() + ': ' + event.message);
    //[#foo] nick: message
});
Resolving all dependencies.. This could take a while as our cache is not yet fully warmed up.