ch.api.js
v1.3.6
Published
A chat API meant to interface with as many chat services as possible.
Downloads
9
Maintainers
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, but built to work not only on Discord, but Revolt, Telegram, and more.
Installation
npm install ch.api.js
Example Usage
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 Discord Support Server Revolt Support Server