Generic

Introduction

Important: You may be in the wrong place. If you’re looking for documentation on how to use the library, you can find that here.

This documentation is primarily aimed at contributors and maintainers of the project. It provides a detailed presentation of the codebase's inner workings, offering a clear understanding of how the project functions.

General

This section covers information on the general workings of the whole platform.

Projects

The structure of things is shown below:

Main

Dashboard

Docs

Legal

Functions

Websockets

Common

Firestore Security Testing

CLI

ts-api

Client

Types

User

Each user is kept in two places: Firebase Auth, and Firestore. Firebase Auth handles authentication and storing data such as passwords, emails, and display names. Firestore keeps a document on the user, stored in a document at /users/{user_uid}. This document contains the following information:

This document then contains a subcollection of Packages.

Additional

Package

A package is a piece of code that can be used for various purposes. For example, a package may be used to achieve a specific goal. However, there may also exist packages that provide utility functions, which can then be imported into other packages. Packages are stored under the user that created them at /users/{user_uid}/packages/{package_uid}. This document contains the following information:

Additional

Token

Tokens are created by the user, specifically to allow the CLI to access aspects of the user such as their packages. Tokens are stored inside of a root collection at /tokens/{token_uid}. This document contains the following information:

Additional

Networking

This project follows a similar approach Minecraft has taken with their networking. The TCP protocol is used for communicating to and from the bot client. Transferring data is converted to bytes, using big endian ordering.

Parties

Server

The server is a very simple websocket, that basically just relays instructions between clients and bots. To relay information, the server internally stores the connected clients and bots, so that relaying is possible.

Rate Limiting

To prevent the server from being spammed hard with too many actions between client and bots, the server keeps track of the count of actions of a bot. Each bot is allowed a maximum of X actions queued at a time, and the server will enforce this. The API for interacting with the bot has been built in a way that considers this limitation.

When either the bot or client disconnects, all relevant counters are removed.

Multiple Clients

The server can handle multiple clients for a single bot. That being said, if multiple clients are writing to a single bot, some confusing things will probably occur.

Client

Server/Bot Disconnection

When the client disconnects from the server/bot, all relevant bot state is erased to prevent out-of-sync info being used.

Bot

Definitions

Data Types

Name Size (bytes) Notes
Boolean 1 The version of the bot client.
VarInt ≥ 1
≤ 5 An integer between -2147483648 and 2147483647.
Variable-length data encoding a two's complement signed 32-bit integer.
String ≥ 1
≤ (n×3) + 3 UTF-8 string prefixed with its size in bytes as a VarInt. Maximum length of n characters, which varies by context. The encoding used on the wire is regular UTF-8, not Java's "slight modification". However, the length of the string for purposes of the length limit is its number of UTF-16 code units, that is, scalar values > U+FFFF are counted as two. Up to n × 3 bytes can be used to encode a UTF-8 string comprising n code units when converted to UTF-16, and both of those limits are checked. Maximum n value is 32767. The + 3 is due to the max size of a valid length VarInt.
Array of X count times size of X A list of type X.
X Enum size of X A specific value from a given list.
UUID
Optional<Type> size of Type + 1 This is an optional type, so may not be supplied.

ActionData

Field Name Field Type Notes
Action Type ID Byte The ID of the packet.
Data Object The action data.

Action

Field Name Field Type Notes
Action UID UUID The unique identifier of the action.
Action Data ActionData The action data.

Bot

| --- | --- | --- |

Packets

Introduction (Bot → Server)

| --- | --- | --- | --- |

MinecraftPacket (Bot → Server)

| --- | --- | --- | --- |

Access Tokens