# ch.api.js

> A chat API meant to interface with as many chat services as possible.

Latest version **1.3.6** (published 2021-12-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install ch.api.js
pnpm add ch.api.js
yarn add ch.api.js
bun add ch.api.js
```

## 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.3.6 |
| Published | 2021-12-23 |
| First published | 2021-12-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 55.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Sophie |
| Maintainers | so_fi |
| Keywords | api, chat, discord, revolt, telegram, ch.ai, chai |

## Links

- npm: https://www.npmjs.com/package/ch.api.js
- Repository: https://github.com/glacierheavner/ch.api
- Homepage: https://github.com/glacierheavner/ch.api#readme
- Issues: https://github.com/glacierheavner/ch.api/issues
- npm.io page: https://npm.io/package/ch.api.js

## Dependencies (3)

- [revolt.js](https://npm.io/package/revolt.js.md) ^5.1.0-alpha.15
- [discord.js](https://npm.io/package/discord.js.md) ^13.3.1
- [node-telegram-bot-api](https://npm.io/package/node-telegram-bot-api.md) ^0.56.0

## Recent versions

- 1.3.6 (latest) — 2021-12-23
- 1.3.5 — 2021-12-23
- 1.3.4 — 2021-12-23
- 1.3.3 — 2021-12-23
- 1.3.2 — 2021-12-20
- 1.3.1 — 2021-12-20
- 1.3.0 — 2021-12-20
- 1.2.3 — 2021-12-20
- 1.2.2 — 2021-12-20
- 1.2.1 — 2021-12-19
- 1.2.0 — 2021-12-19
- 1.1.0 — 2021-12-19
- 1.0.7 — 2021-12-19
- 1.0.6 — 2021-12-19
- 1.0.5 — 2021-12-19
- … 5 more at https://npm.io/package/ch.api.js/versions

## README

# ch.api.js

Chat Application Programming Interface, or ch.api.js, is a package built to connect chat applications. Think of it as [Discord.js](https://www.npmjs.com/package/discord.js), but built to work not only on Discord, but Revolt, Telegram, and more.

## Installation

```bash
npm install ch.api.js
```

## Example Usage

```js
const { Client } = require("ch.api.js");
const config = require("./config.json");

// Create the ch.api client with a prefix.
const client = new Client({
    prefix: "ch."
});

// The "ready" event is called whenever a client is ready.
// This means that it gets called once for Discord, once for Revolt, once for Telegram, etc.
client.on("ready", (client) => {
    console.log(`Logged into ${client.name.toUpperCase()}!`);
});

// The "message" even is called whenever a message is recieved.
client.on("message", async (message, client) => {
    console.log(`${client.name} message: ${message.author.username} said "${message.content}"`);
});

// This logs into any clients that have a token supplied.
client.login({
    telegramToken: config.tokens.telegram,
    discordToken: config.tokens.discord,
    revoltToken: config.tokens.revolt
});
```

---

## Support

### Support Server Invites

[Telegram Support Server](https://t.me/+32NeAwwbGXJmODYx)<br>
[Discord Support Server](https://discord.gg/E4dgsytzRs)<br>
[Revolt Support Server](https://app.revolt.chat/invite/dFeJfhf0)

### Bot Invites

[Telegram Bot Invite](http://t.me/ch_ai_bot)<br>
[Discord Bot Invite](https://discord.com/api/oauth2/authorize?client_id=908220543558381588&permissions=8&scope=bot)<br>
[Revolt Bot Invite](https://app.revolt.chat/bot/01FM6NHPY1DB31RCPDSBHD1M2J)

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