npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lib-irc

v0.3.7

Published

A fork of martynsmith/node-irc that allows address binding

Downloads

2

Readme

node-irc_ is an IRC client library written in JavaScript_ for Node_.

.. _node-irc: http://node-irc.readthedocs.org/ .. _JavaScript: http://en.wikipedia.org/wiki/JavaScript .. _Node: http://nodejs.org/

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 I really recommend using npm_!

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 favourite 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 Documentation

Further documentation (including a complete API reference) are 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 I'll do my best to accommodate.

.. _npm: http://github.com/isaacs/npm .. _here: http://node-irc.readthedocs.org/en/latest/API.html .. _Read the Docs: http://readthedocs.org/docs/node-irc/en/latest/ .. _Node JS EventEmitter documentation: http://nodejs.org/api/events.html#events_class_events_eventemitter