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

emiirc

v0.0.1

Published

event emitting irc client

Downloads

5

Readme

emiirc

event emitting irc client.

GitHub license npm Project Status

Usage

// test.mjs
import loginAndJoin from './src/plugins/login-join.mjs';
import reconnect from './src/plugins/reconnect.mjs';
import Client from '.';

const [nick, pass] = (process.argv[2] || '').split(':');

const client = new Client('irc.freenode.net', '6667', {
  nick: nick || 'emiircbot-demo',
});

client.use(reconnect());
client.use(loginAndJoin(process.argv.slice(3) || [], pass));

if (Number(process.env.DEBUG) >= 2) client.on('data', data => console.log('DEBUG|', data));
if (Number(process.env.DEBUG) >= 1) client.on('notice', data => console.log('NOTICE|', data));

client.on('connected', () => console.log('CONNECTED'));
client.on('close', () => console.log('CONNECTION CLOSED'));
client.on('error', err => console.error(err));

client.on('nick_used', res => console.log('nick_used', res));
client.on('nick_unidentified', res => console.log('nick_unidentified', res));
client.on('nick_identified', res => console.log('nick_identified', res));

client.on('motd', () => console.log('MOTD complete'));
client.on('send', d => console.log('SEND|', d));
client.on('message', res => console.log('message|', res));
client.on('private', res => console.log('private|', res));
client.on('command', res => console.log('command|', res));

client.on('join', res => console.log('join|', res));
client.on('join_failed', res => console.log('join_failed|', res));
client.on('join_users', res => console.log('join_users|', res));
client.on('join_topic', res => console.log('join_topic|', res));
client.on('part', res => console.log('part|', res));
client.on('quit', res => console.log('quit|', res));

client.connect();

Then node test.mjs mybot emiirc-demo-channel. The following will create a new instance with a nick "mybot", join the channel "#emiirc-demo-channel" and start parsing input from IRC.

NOTE: You may need to use node --experimental-modules or node -r esm depending on your node version's ESM support.

Given the following observations:

  1. Public welcome message from user "w33ble"
  2. Public command via !mybot from user "w33ble"
  3. Private message from user "w33ble"

You should see the following output:

CONNECTED
SEND| NICK mybot
SEND| USER emiirc-260ca9 8 * :an emiirc bot
SEND| JOIN #emiirc-demo-channel
MOTD complete
private| { user: 'frigg', room: 'mybot', msg: '\u0001VERSION\u0001\r' }
join| { room: '#emiirc-demo-channel', user: 'mybot' }
join_topic| { room: 'mybot', topic: 'testing out emiirc\r' }
join_users| { room: 'mybot', users: [ 'mybot', 'w33ble' ] }join| { user: 'mybot', room: '#emiirc-demo-channel' }
message| { user: 'w33ble',
  room: '#emiirc-demo-channel',
  msg: 'hello mybot!\r' }
command| { user: 'w33ble',
  room: '#emiirc-demo-channel',
  msg: 'make me a sandwich' }
private| { user: 'w33ble',
  room: 'mybot',
  msg: 'let\'s have a private chat, shall we?\r' }

License

MIT © w33ble