This package has been deprecated

Author message:

I wrote this module a very long time ago; you should use something else.

ircrpc

0.0.1 • Public • Published

IRCRPC

IRCRPC is a toy project which treats IRC bots as online APIs.

What? Why?

Why not? People talk about other online APIs all the time: RESTful APIs, streaming APIs, [JSON|XML]-RPC, etc. IRC bots are query-able APIs too! They're just usually meant for human use is all. Well, no longer will people have a monopoly.

For example, probably the easiest way to interact with farnsworth right now is likely through its IRC bot (called 'farnsworth'). I looked into installing it local, and it's not particularly easy.

So, as an example for using this kind of thing: Here are the contents of ./bin/farnsworth:

#!/usr/bin/env node

var ircrpc = require('ircrpc');
var query = process.argv.slice(2).join(' ');

ircrpc.connect('irc.freenode.net', function(client) {
    var farnsworth = client.addService({ nick: 'farnsworth'});

    farnsworth(query, function (msg) {
        console.log(msg);
        client.disconnect();
    });
});

With that, we can now use farnsworth from the command line!:

josh@pidgey:~$ farnsworth "1 kg -> lbm"
(100000000/45359237 /* apx (2.20462262184877) */)
josh@pidgey:~$ 

The interface is a little clunky and making an irc connection for every little query is slow as molasses, but it works!

Potential?

Maybe. It's probably not the most elegant way to access an API, but there are a lot of bots online! Some of them are like farnsworth, in that there isn't really an alternative API. IRCRPC may also make a good platform for pubsub action (publish by messaging a chat room, subscribe by idling the same chat room).

Install

This can be installed with npm:

npm install ircrpc

However, in order to work this requires a version of node-irc that is newer than what is on npm. To get it, just do something like:

git clone https://github.com/martynsmith/node-irc.git && cd node-irc && npm link ./

or, wait until Martyn updates the npm-ified version of node-irc.

Readme

Keywords

none

Package Sidebar

Install

npm i ircrpc

Weekly Downloads

2

Version

0.0.1

License

none

Last publish

Collaborators

  • jesusabdullah