# @metsjeesus/irc-framework

> A better IRC framework for node.js

Latest version **2.5.1** (published 2016-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @metsjeesus/irc-framework
pnpm add @metsjeesus/irc-framework
yarn add @metsjeesus/irc-framework
bun add @metsjeesus/irc-framework
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.5.1 |
| Published | 2016-09-29 |
| First published | 2016-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 201 |
| Author | prawnsalad |
| Maintainers | metsjeesus |
| Keywords | IRC, bot, messaging |

## Links

- npm: https://www.npmjs.com/package/@metsjeesus/irc-framework
- Repository: https://github.com/kiwiirc/irc-framework
- Homepage: https://github.com/kiwiirc/irc-framework#readme
- Issues: https://github.com/kiwiirc/irc-framework/issues
- npm.io page: https://npm.io/package/@metsjeesus/irc-framework

## Dependencies (8)

- [lodash](https://npm.io/package/lodash.md) ^3.10.1
- [es6-set](https://npm.io/package/es6-set.md) ^0.1.3
- [socksjs](https://npm.io/package/socksjs.md) ^0.5.0
- [iconv-lite](https://npm.io/package/iconv-lite.md) ^0.4.11
- [middleware-handler](https://npm.io/package/middleware-handler.md) ^0.2.0
- [string.prototype.at](https://npm.io/package/string.prototype.at.md) ^0.2.0
- [string.fromcodepoint](https://npm.io/package/string.fromcodepoint.md) ^0.2.1
- [string.prototype.codepointat](https://npm.io/package/string.prototype.codepointat.md) ^0.2.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 2.5.1 (latest) — 2016-09-29

## README

# irc-framework
A better IRC framework for node.js. For bots and full clients. (a work in progress)

### Aims
* Lightweight
* Performant
* Very easy to get going out of the box
* Grows as needed for larger applications
* IRCv3 compliant
* Multiple (+ auto detected) encoding support
* Complete test suite

### Status
Currently ripped out of the Kiwi IRC project and running independently.

Todo:
* ~~Remove all references to any Kiwi IRC specific internals.~~
* Implement an event proxy for `Channel` objects to enable `channel.on('event', ..)`.
* ~~Do something nice with all the commands in commands/misc.js, maybe even delete them and expect the application to handle these via the `raw` event.~~
* ~~Rename `commands/` to `command_handlers/`~~
* Implement some form of debugging. Look into the `debug` module?


#### A simple and low-boilerplate framework to build IRC bots.
~~~javascript
var bot = new IRC.Client();
bot.connect({
	host: 'irc.freenode.net',
	port: 6667,
	nick: 'prawnsbot'
});

bot.on('message', function(event) {
  	if (event.message.indexOf('hello') === 0) {
  		  event.reply('Hi!');
  	}
  	
  	if (event.message.match(/^!join /)) {
  	    var to_join = event.message.split(' ');
  		event.reply('Joining ' + to_join + '..');
  		bot.join(to_join);
  	}
});


// Or a quicker to match messages...
bot.matchMessage(/^hi/, function(event) {
	event.reply('hello there!');
});
~~~

#### Channel/buffer objects. Great for building clients
~~~javascript
var bot = new IRC.Client();
bot.connect({
	host: 'irc.freenode.net',
	port: 6667,
	nick: 'prawnsbot'
});

var buffers = [];
bot.on('registered', function() {
	var channel = bot.channel('#prawnsalad');
	buffers.push(channel);
	
	channel.join();
	channel.say('Hi!');
	
	channel.updateUserList(function() {
		console.log(channel.users);
	});

	// Or you could even stream the channel messages elsewhere
	var stream = channel.stream();
	stream.pipe(process.stdout);
});
~~~


#### Middleware
~~~javascript
function ExampleMiddleware() {
	return function(client, raw_events, parsed_events) {
		parsed_events.use(theMiddleware);
	}


	function theMiddleware(command, event, client, next) {
		if (command === 'registered') {
			if (client.options.nickserv) {
				var options = client.options.nickserv;
				client.say('nickserv', 'identify ' + options.account + ' ' + options.password);
			}
		}

		if (command === 'message' && event.event.nick.toLowerCase() === 'nickserv') {
			// Handle success/retries/failures
		}

		next();
	}
}


var irc_bot = new IRC.Client();
irc_bot.use(ExampleMiddleware());
~~~

---
_Source: https://npm.io/package/@metsjeesus/irc-framework · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
