irc0.5.2 • Public • Published
You can access more detailed documentation for this module at Read the Docs
The easiest way to get it is via npm:
npm install irc
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.
This library provides basic IRC client functionality. In the simplest case you can connect to an IRC server like so:
var irc = ;var 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:
or if you're only interested in messages to the bot itself:
or to a particular channel:
At the moment there are functions for joining:
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:
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.:
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.