# cuffeo

> A multi-protocol chatbot library with nearly zero dependencies.

Latest version **1.2.2** (published 2023-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install cuffeo
pnpm add cuffeo
yarn add cuffeo
bun add cuffeo
```

## 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.2.2 |
| Published | 2023-04-23 |
| First published | 2019-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 31.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Flummi & jkhsjdhjs |
| Maintainers | flummi, jkhsjdhjs |
| Keywords | cuffeo, irc, telegram, slack |

## Links

- npm: https://www.npmjs.com/package/cuffeo
- Repository: gitea@git.lat:keinBot/cuffeo
- Homepage: https://git.lat/keinBot/cuffeo
- Issues: https://git.lat/keinBot/cuffeo/issues
- npm.io page: https://npm.io/package/cuffeo

## Dependencies (1)

- [flumm-fetch](https://npm.io/package/flumm-fetch.md) ^1.0.1

## 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

- 1.2.2 (latest) — 2023-04-23
- 1.2.1 — 2022-05-09
- 1.2.0 — 2022-05-09
- 1.1.1 — 2022-05-09
- 1.1.0 — 2022-05-07
- 1.0.8-1 — 2022-05-07
- 1.0.8 — 2022-05-07
- 1.0.7-3 — 2021-05-11
- 1.0.7-2 — 2021-01-27
- 1.0.7 — 2021-01-25
- 1.0.6-1 — 2020-04-02
- 1.0.6 — 2020-03-01
- 1.0.5-3 — 2020-02-20
- 1.0.5-2 — 2020-02-20
- 1.0.5-1 — 2020-02-17
- … 4 more at https://npm.io/package/cuffeo/versions

## README

# cuffeo (wip)

## Usage Example
```javascript
import cuffeo from "cuffeo";

(async () => {
  const clients = [
    {
      type: "irc",
      enabled: true,
      network: "name",
      host: "localhost",
      port: 6697,
      ssl: true,
      selfSigned: false,
      sasl: false,
      nickname: "nickname",
      username: "username",
      password: "password",
      realname: "realname",
      channels: [
        "#blah"
      ]
    },
    {
      type: "tg",
      enabled: true,
      token: "token",
      pollrate: 1001
    },
    {
      type: "slack",
      enabled: true,
      token: "token"
    }
  ];

  const bot = await new cuffeo(clients);

  // events
  bot.on("message", msg => {
    msg.reply("hello, world!");
  });

  bot.on("info", msg => {
    console.log(msg);
  });

  bot.on("error", err => {
    console.error(err);
  });

  bot.on("ctcp:ping", msg => { // irc only
    msg.write(`notice ${msg.user.nick} :${e.message}`);
  });

  bot.on("ctcp:version", msg => { // irc only
    msg.write(`notice ${msg.user.nick} :\u0001VERSION blah\u00001`);
  });
})();
```

## documentation

### clients
#### irc
```json
{
  "type": "irc",
  "enabled": true,
  "network": "name",
  "host": "localhost",
  "port": 6697,
  "ssl": true,
  "selfSigned": false,
  "sasl": false,
  "nickname": "nickname",
  "username": "username",
  "password": "password",
  "realname": "realname",
  "channels": [
    "#blah"
  ]
}
```
#### Telegram
```json
{
  "type": "tg",
  "enabled": true,
  "token": "token",
  "pollrate": 1001
}
```
#### Slack
```json
{
  "type": "slack",
  "enabled": true,
  "token": "token"
}
```

### Events
#### message
returns an object, containing:

| variable | type | explanation | note
| --- | --- | --- | --- |
| type | string | irc, tg or slack | |
| network | string | irc only, other it'll be "telegram" or "slack" | |
| channel | string | | |
| user | object | see below | |
| message | string | | |
| time | string | timestamp | |
| raw | object | | |
| reply | function | | |
| replyAction | function | | |
| replyNotice | function | | |
| self | object | | |
| _chan | object | | irc only |
| _user | object | | irc and telegram only |
| join | function | join a channel | irc only |
| part | function | part a channel | irc only |
| whois | function | request a whois | irc only |
| write | function | write raw lul | |

---
##### user object
| variable | type |
| --- | --- |
| account | string |
| prefix | string |

##### reply/replyAction/replyNotice function
```javascript
msg.reply("message");
msg.replyAction("message");
msg.replyNotice("message"); // same as reply() on Slack and Telegram
```
##### join function
```javascript
msg.join("#channel");
```
##### part function
```javascript
msg.part("#channel", "message");
// or
msg.part([ "#channel1", "#channel2" ], "message");
```
##### whois function
```javascript
msg.whois("user");
// or
msg.whois([ "user1", "user2" ]);
```


## irc related stuff
### color your messages
```javascript
msg.reply("[color=red]message[/color]");
```
allowed colors:
- white
- black
- navy
- green
- red
- brown
- purple
- orange
- yellow
- lightgreen
- teal
- cyan
- blue
- magenta
- gray
- lightgray

### bold and italic
```javascript
msg.reply("[b]bold[/b]");
msg.reply("[i]italic[/i]");
```

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