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 🙏

© 2026 – Pkg Stats / Ryan Hefner

talos

v1.0.1

Published

A middleware-based IRC bot framework inspired by ExpressJS.

Readme

talos

An ExpressJS-inspired middleware framework for IRC bots in Node.

var Talos = require('talos'),
    bot = new Talos({
        host: 'irc.freenode.net',
        nick: 'baconbot',
        channels: ['#baconmania']
    });

bot.use(Talos.listenFor(/^!baconbot/));
bot.use(Talos.tokenize());
bot.use(Talos.router());

bot.onMessage('echo', function(req, res, next) {
    res.send(req.tokenized.args.join(' '));
    next();
});

bot.connect();
baconmania: !baconbot echo this and that
baconbot: this and that

Installation

$ npm install talos

Writing middleware

Each piece of middleware you write should take three arguments: req, res, and next.

req

The req object presents the following interface:

var req = {
    fromUser: 'somenick',
    channel: 'somechannel',
    metadata: { ... }, // passed through from node-irc
    incomingMessage: 'some message'
};

res

The res object exposes a single function, send(message). Call this function to send the string message back to the channel or nick which sent a message to your bot.

next

Every piece of middleware you write must call next() to pass control to the next piece of middleware in the pipeline.

You can call next(err) to skip the remaining middleware in the pipeline. Talos will print the given error to stderr.

Bundled middleware

Talos comes with a minimal set of middleware which implements functionality that most IRC bots will need.

listenFor

Ignores all messages which don't match the given trigger RegEx.

When a message comes in and matches the given trigger, the trigger is removed from the incoming message text before control is passed to the next request handler.

bot.use(Talos.listenFor(/^!baconbot/));

tokenize

Splits each incoming message up into a command and a list of arguments. These get stored in a new tokenized property on the req object.

bot.use(Talos.tokenize());

If the bot received the message echo foo bar baz, then the req object would look something like:

var req = {
    ...,
    tokenized: {
        command: 'echo',
        args: ['foo', 'bar', 'baz']
    },
    ...
}

bannedUsers

Requires Talos.tokenize()

bot.use(Talos.tokenize());
...
bot.use(Talos.bannedUsers());

You can also pass in a list of banned users to initialize with.

bot.use(Talos.bannedUsers(['baconmania', 'otherbannednick']));

With this middleware activated, you can say ignore <nick> and unignore <nick> in IRC to ban and unban users, respectively.

router

Requires Talos.tokenize()

Exposes the Talos.prototype.onMessage([trigger,] handler) function.

When an incoming message's first word token matches any of the defined triggers, each matching trigger's associated handler is called.

To define a catch-all handler, simply omit the trigger argument when calling onMessage(). Note that calling onMessage(handler), with no trigger, is equivalent to calling use(handler).

bot.use(Talos.tokenize());
...
bot.use(Talos.router());

bot.onMessage('echo', function(req, res, next) {
    res.send(req.tokenized.args.join(' '));
    next();
});

bot.onMessage(function(req, res, next) {
    res.send('you hit a catch-all handler.');
    next();
});

Low-level access to IRC client

res.send() is an easy way to reply to the channel or user which originally messaged your bot. If you have a more sophisticated use-case, you may wish to drop down to the node-irc client used by Talos.

var Talos = require('talos'),
    bot = new Talos({ ... });

bot.use(function(req, res, next) {
    bot._client.say('#someOtherChannel', 'hello');
});

Refer to the node-irc module for more information.