⚠️ USE TRIANGLE.JS (@haelp/teto) INSTEAD
A Node.js library for tetr.io and ch.tetr.io, asynchronous and typed (well, mostly)
Warning
this library is still in heavy development. although useable, very fragile.
tetr.io is still in alpha, any new updates to the game have a chance to break the library if it goes unnoticed.
use an authorized bot account if you're trying to connect to the gateway or interact with the main game api!
Client
the main guyapi
wrapper around the rest apichannel
tetra channelgame
main game
CONSTANTS
bunch of enum-dictionary-like helper objectTypes
bonus, typings for stuff like ribbon messaging, room config schema, etc
// test.ts - connect to gateway
import { Client, CONSTANTS } from "crimson.js"
const session = new Client("<token>")
session.events.on(CONSTANTS.EVENTS_TYPES.SESSION_READY, (endpoint) =>
{
console.log("ready!")
console.log(`connected to ${endpoint} as ${client.user.username}`)
})
session.login()
λ npm install --production=false
locally install the dependencies, ts, tsup, and other dev dependenciesλ tsc
and emits the transpiled codes to./out/
λ npx run bundle
and emits the bundled cjs, esm, and dts codes to./dist/
λ npx run docs
to build the auto-generated docs and emits it to./docs/
λ npx install -S
in a testing directory with"crimson.js": "file:<lib dir rel path>"
inpackage.json
dependencies field
- my personal discord guild
- or the newly established dev-oriented tetr.io community guild (recommended)
- unofficial tetr.io bot docs (slightly outdated but still relevant)
- tetra channel api docs
- npm
Pull requests, open issues, or just a direct messages for any new ideas (especially with structuring the api and naming things) is all appreciated!
- osk, obviously, for creating tetr.io
- Zudo, for open sourcing the original Autohost source code
- craftxbox, for continuing Autohost development
Distributed under the Artistic License 2.0 with <3