@spacebarchat/spacebar-ts
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Spacebar-ts

WIP API library for the Spacebar API

Example

import { Client } from "spacebar-ts";

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("token");

MobX

MobX is used behind the scenes so you can subscribe to any change as you normally would, e.g. with mobx-react(-lite) or mobx's utility functions.

import { autorun } from 'mobx';

[..]

client.once('ready', () => {
    autorun(() => {
        console.log(`Current username is ${client.user!.username}!`);
    });
});

Spacebar API Types

All @spacebarchat/spacebar-types types are re-exported under API.

import { API } from "spacebar-ts";

// API.Channel;
// API.[..];

Dependencies (9)

Dev Dependencies (9)

Package Sidebar

Install

npm i @spacebarchat/spacebar-ts

Weekly Downloads

0

Version

0.0.4

License

AGPL-3.0-only

Unpacked Size

3.13 MB

Total Files

112

Last publish

Collaborators

  • puyodead1
  • maddyunderstars