martynsmith/node-irc


NodeJS IRC client library

License: GPL-3.0

Language: JavaScript


Travis npm Dependency Status devDependency Status License Join the chat at https://gitter.im/martynsmith/node-irc

node-irc is an IRC client library written in JavaScript for Node.

You can access more detailed documentation for this module at Read the Docs

Installation

The easiest way to get it is via npm:

npm install irc

If you want to run the latest version (i.e. later than the version available via npm) you can clone this repo, then use npm to link-install it:

    npm link /path/to/your/clone

Of course, you can just clone this, and manually point at the library itself, but we really recommend using npm!

Note that as of version 0.3.8, node-irc supports character set detection using icu. You'll need to install libiconv (if necessary; Linux systems tend to ship this in their glibc) and libicu (and its headers, if necessary, install instructions) in order to use this feature. If you do not have these libraries or their headers installed, you will receive errors when trying to build these dependencies. However, node-irc will still install (assuming nothing else failed) and you'll be able to use it, just not the character set features.

Basic Usage

This library provides basic IRC client functionality. In the simplest case you can connect to an IRC server like so:

var irc = require('irc');
var client = new irc.Client('irc.yourserver.com', 'myNick', {
    channels: ['#channel'],
});

Of course it's not much use once it's connected if that's all you have!

The client emits a large number of events that correlate to things you'd normally see in your favorite IRC client. Most likely the first one you'll want to use is:

client.addListener('message', function (from, to, message) {
    console.log(from + ' => ' + to + ': ' + message);
});

or if you're only interested in messages to the bot itself:

client.addListener('pm', function (from, message) {
    console.log(from + ' => ME: ' + message);
});

or to a particular channel:

client.addListener('message#yourchannel', function (from, message) {
    console.log(from + ' => #yourchannel: ' + message);
});

At the moment there are functions for joining:

client.join('#yourchannel yourpass');

parting:

client.part('#yourchannel');

talking:

client.say('#yourchannel', "I'm a bot!");
client.say('nonbeliever', "SRSLY, I AM!");

and many others. Check out the API documentation for a complete reference.

For any commands that there aren't methods for you can use the send() method which sends raw messages to the server:

client.send('MODE', '#yourchannel', '+o', 'yournick');

Help! - it keeps crashing!

When the client receives errors from the IRC network, it emits an "error" event. As stated in the Node JS EventEmitter documentation if you don't bind something to this error, it will cause a fatal stack trace.

The upshot of this is basically that if you bind an error handler to your client, errors will be sent there instead of crashing your program.:

client.addListener('error', function(message) {
    console.log('error: ', message);
});

Further Support

Further documentation (including a complete API reference) is available in reStructuredText format in the docs/ folder of this project, or online at Read the Docs.

If you find any issues with the documentation (or the module) please send a pull request or file an issue and we'll do our best to accommodate.

You can also visit us on ##node-irc on freenode to discuss issues you're having with the library, pull requests, or anything else related to node-irc.

Project Statistics

Sourcerank 14
Repository Size 1.2 MB
Stars 1,214
Forks 389
Watchers 48
Open issues 113
Dependencies 5
Contributors 97
Tags 21
Created
Last updated
Last pushed

Top Contributors See all

Martyn Smith Justin Gallardo masochist Fionn Kelleher Jakob Westhoff Mathias Rav Wraithan (Chris McDonald) Trinitas Mischa Spiegelmock Esa-Matti Suuronen fent Jon Rohan Alex Whitman David Murphy Quentin Sheets Tarmo Leppänen Eirik Brandtzæg Sean Fern Jann Damian Bushong

Packages Referencing this Repo

fwilson-irc-fork
An IRC client library for node
Latest release 0.3.6 - Updated - 1.21K stars
wirc
An IRC client library for node that works
Latest release 0.3.6 - Published - 1.21K stars
irc-t-of-twitch
An IRC client library for node
Latest release 0.5.2 - Published - 1.21K stars
irc
An IRC client library for node
Latest release 0.5.2 - Updated - 1.21K stars

Recent Tags See all

v0.5.2 November 25, 2016
v0.5.1 November 17, 2016
v0.5.0 March 26, 2016
v0.4.1 January 27, 2016
v0.4.0 September 30, 2015
v0.3.12 April 25, 2015
v0.3.11 April 06, 2015
v0.3.10 April 02, 2015
v0.3.9 January 16, 2015
v0.3.7 January 09, 2015
v0.3.8 January 09, 2015
v0.3.5 January 01, 2013
v0.3.3 November 16, 2011
v0.3.2 October 30, 2011
v0.3.1 October 29, 2011

Interesting Forks See all

Throne3d/node-irc
NodeJS IRC client library
JavaScript - GPL-3.0 - Last pushed - 14 stars - 5 forks
matrix-org/node-irc
NodeJS IRC client library
JavaScript - GPL-3.0 - Last pushed - 5 stars - 8 forks
scrollback/node-irc
NodeJS IRC client library
JavaScript - GPL-3.0 - Last pushed - 5 stars
botriot/node-irc
NodeJS IRC client library
JavaScript - GPL-3.0 - Last pushed - 4 stars - 1 forks
guanix/node-irc
NodeJS IRC client library
JavaScript - GPL-3.0 - Last pushed - 3 stars - 1 forks

Something wrong with this page? Make a suggestion

Last synced: 2017-04-21 16:20:49 UTC

Login to resync this repository