coffea documentation/api¶
event based and extensible irc client library with multi-network support
For support, report an issue on github or join our IRC channel at
quickstart¶
This is all the code needed to get you started with coffea!
var client = require('coffea')(['chat.freenode.net', 'irc.oftc.net']); // or put just one network as a string
client.on('motd', function (err, event) {
client.join(['#foo', '#bar', '#baz'], event.network);
});
client.on('message', function (err, event) {
console.log('[' + event.network + '][' + event.channel.getName() + '] ' + event.user.getNick() + ': ' + event.message);
//[freenode][#foo] nick: message
event.reply(event.message); // I'm a parrot
});
with ssl¶
If you want to enable SSL for a connection, you have to use a network config object when connecting:
var client = require('coffea')({
host: 'chat.freenode.net',
ssl: true
});
api¶
The best way to get started with coffea is playing around with it! You can use
the Index to get a list of functions
and events
you can make use of.
coffea function: A function called with client.function()
if coffea was
imported to client
(see Quickstart)
client.function();
coffea event: You can listen to an event by defining an event listener like
this (make sure to replace event
with the event name):
client.on('event', function (err, event) {
if (err) throw err; // something bad happened!
console.log(event); // do something with event here
});
Go to API reference or browse the API by...