# nwitch-custom-commands

> nwitch plugin for defining custom commands

Latest version **1.0.1** (published 2014-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install nwitch-custom-commands
pnpm add nwitch-custom-commands
yarn add nwitch-custom-commands
bun add nwitch-custom-commands
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2014-11-28 |
| First published | 2014-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kenan Yildirim |
| Maintainers | kenan |
| Keywords | nwitch, nwitch-plugin |

## Links

- npm: https://www.npmjs.com/package/nwitch-custom-commands
- Repository: https://github.com/nwitch/nwitch-custom-commands
- Issues: https://github.com/nwitch/nwitch-custom-commands/issues
- npm.io page: https://npm.io/package/nwitch-custom-commands

## Dependencies (1)

- [behest](https://npm.io/package/behest.md) ^1.0.0

## Recent versions

- 1.0.1 (latest) — 2014-11-28
- 1.0.0 — 2014-11-28

## README

# nwitch-custom-commands

[nwitch][] (and [slate-irc][]) plugin that allows you to define responses for
any command.

``` irc
05:34 <KenanY> !foo
05:34 <nwitch> KenanY: bar
05:35 <KenanY> !baz
05:35 <nwitch> KenanY: foobar
```

## Example

As a [nwitch][] plugin (using `config.toml`):

``` toml
[plugins.nwitch-custom-commands]
foo = "bar"
baz = "foobar"
```

Or through [nwitch][]'s API:

``` javascript
var Nwitch = require('nwitch');
var customCommands = require('nwitch-custom-commands');

var nwitch = new Nwitch({
  irc: {
    address: 'irc.freenode.org',
    port: 6667
  }
});

nwitch.use(customCommands({
  'foo': 'bar',
  'baz': 'foobar'
}));
```

Technically, all [nwitch][] plugins are just [slate-irc][] plugins, so you could
also use this as a [slate-irc][] plugin:

``` javascript
var net = require('net');
var irc = require('slate-irc');
var customCommands = require('nwitch-custom-commands');

var stream = net.connect({
  port: 6667,
  host: 'irc.freenode.org'
});

var client = irc(stream);
client.use(customCommands({
  'foo': 'bar',
  'baz': 'foobar'
}));
```

## Installation

``` bash
$ npm install nwitch-custom-commands
```

## API

``` javascript
var customCommands = require('nwitch-custom-commands');
```

### `customCommands(opts)`

Given an _Object_ `opts`, registers a new command for each key-value in `obj`.
The value of each key is the output for a command matching the key.


   [nwitch]: https://github.com/KenanY/nwitch
   [slate-irc]: https://github.com/slate/slate-irc

---
_Source: https://npm.io/package/nwitch-custom-commands · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
