mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-18 16:34:27 -04:00
2c3d0c5366fab04034c78a7bf92177423142719b
Client.ts: change Events.error callback argument from any to Error Only location where the "error" event was emitted: https://github.com/stoatchat/javascript-client-sdk/blob/cdf406094b9b81c3ff285b14ed97fb3d138e3061/src/Client.ts#L263 Callback argument type where that "error" event comes from: https://github.com/stoatchat/javascript-client-sdk/blob/main/src/events/EventClient.ts#L70 Signed-off-by: Taureon <45183108+Taureon@users.noreply.github.com>
stoat.js
stoat.js is a JavaScript library for interacting with the Stoat API
Requirements
To use this module, you must be using at least:
- Node.js v22.15.0 (LTS) in ES module mode
- or Deno v2.2 (LTS)
Example Usage
import { Client } from "stoat.js";
let client = new Client();
client.on("ready", async () =>
console.info(`Logged in as ${client.user.username}!`),
);
client.on("message", async (message) => {
if (message.content === "hello") {
message.channel.sendMessage("world");
}
});
client.loginBot("..");
Reactivity with Signals & Solid.js Primitives
All objects have reactivity built-in and can be dropped straight into any Solid.js project.
const client = new Client();
// initialise the client
function MyApp() {
return (
<h1>Your username is: {client.user?.username ?? "[logging in...]"}</h1>
);
}
Stoat API Types
Warning
It is advised you do not use this unless necessary. If you find somewhere that isn't covered by the library, please open an issue as this library aims to transform all objects.
All stoat-api types are re-exported from this library under API.
import { API } from "stoat.js";
// API.Channel;
// API.[..];
Releases
6
Languages
TypeScript
99.4%
JavaScript
0.5%