Properties

autostart: Autostart

The autostart state of the room

chats: {
    content: string;
    content_safe: string;
    pinned: boolean;
    system: boolean;
    user: {
        _id: string;
        role: Role;
        supporter: boolean;
        supporter_tier: number;
        username: string;
        verified: boolean;
    };
}[] = []

Room chat history

creator: string

UID of the room creator (this person can reclaim host)

id: string

the ID of the room

match: Match

The match config for the room

name: string

Name of the room

name_safe: string

Safe Name of the room

options: Options

The room config

owner: string

UID of the host

players: Player[]

The players in the room

public: boolean

Whether or not the room is public

state: State

The current state of the room (ingame | lobby)

type

The type of the room (public | private)

Accessors

  • get isHost(): boolean
  • Whether or not the client is the host

    Returns boolean

Methods

  • Abort the game

    Returns Promise<void>

  • Send a public message to the room's chat. The pinned parameter is the same as using the /announce command in TETR.IO The pinned parameter being true will result in an error if the client is not host.

    Parameters

    • message: string
    • pinned: boolean = false

    Returns Promise<{
        content: string;
        content_safe: string;
        pinned: boolean;
        system: boolean;
        user: {
            _id: string;
            role: Role;
            supporter: boolean;
            supporter_tier: number;
            username: string;
            verified: boolean;
        };
    }>

    await client.room!.chat('hi!');
    
    await client.room!.chat('Important info:', true);
    
  • Clears the chat

    Returns Promise<void>

  • Kick a user from the room for a specified duration (if host)

    Parameters

    • id: string

      id of user to kick

    • duration: number = 900

      duration to kick the user, in seconds

    Returns Promise<string>

    await client.room!.kick('646f633d276f42a80ba44304', 100);
    
  • Leave the bot's current room

    Returns Promise<void>

    await client.room!.leave();
    
  • Move someone's bracket

    Parameters

    • uid: string
    • bracket: "player" | "spectator"

    Returns Promise<{
        bracket: Bracket;
        uid: string;
    }>

    await client.room!.move('646f633d276f42a80ba44304');
    
  • Sets the room id (only works for supporter accounts)

    Parameters

    • id: string

    Returns Promise<{
        auto: Autostart;
        creator: string;
        id: string;
        info: {};
        match: Match;
        name: string;
        name_safe: string;
        options: Options;
        owner: string;
        players: Player[];
        public: boolean;
        state: State;
        topic: {};
        type: "custom";
    }>

    client.room!.setID('TEST');
    
  • Start the game

    Returns Promise<Ready>

  • Switch bracket

    Parameters

    • bracket: "player" | "spectator"

    Returns Promise<{
        bracket: Bracket;
        uid: string;
    }>

    await client.room!.switch('player');
    
  • Take host if you created the room

    Returns Promise<string>

  • Give the host to someone else

    Parameters

    • player: string

    Returns Promise<string>

    await client.room!.transferHost('halp');
    
  • Unban a user from the room

    Parameters

    • username: string

    Returns void

    client.room!.unban('halp');
    
  • Update the room's config, similar to using the /set command in tetr.io await client.room!.update({ index: 'name', value: 'test room'});

    Type Parameters

    • T extends
          | "options.presets"
          | "name"
          | "userLimit"
          | "autoStart"
          | "allowAnonymous"
          | "allowUnranked"
          | "userRankLimit"
          | "useBestRankAsLimit"
          | "forceRequireXPToChat"
          | "gamebgm"
          | "match.gamemode"
          | "match.modename"
          | "match.ft"
          | "match.wb"
          | "options.g"
          | "options.passthrough"
          | "options.stock"
          | "options.display_next"
          | "options.display_hold"
          | "options.gmargin"
          | "options.gincrease"
          | "options.garbagemultiplier"
          | "options.garbagemargin"
          | "options.garbageincrease"
          | "options.garbagecap"
          | "options.garbagecapincrease"
          | "options.garbagecapmax"
          | "options.garbageattackcap"
          | "options.garbageabsolutecap"
          | "options.garbagephase"
          | "options.garbagequeue"
          | "options.garbageare"
          | "options.garbageentry"
          | "options.garbageblocking"
          | "options.garbagetargetbonus"
          | "options.bagtype"
          | "options.spinbonuses"
          | "options.combotable"
          | "options.kickset"
          | "options.nextcount"
          | "options.allow_harddrop"
          | "options.display_shadow"
          | "options.locktime"
          | "options.garbagespeed"
          | "options.are"
          | "options.lineclear_are"
          | "options.infinitemovement"
          | "options.lockresets"
          | "options.allow180"
          | "options.room_handling"
          | "options.room_handling_arr"
          | "options.room_handling_das"
          | "options.room_handling_sdf"
          | "options.manual_allowed"
          | "options.b2bchaining"
          | "options.b2bcharging"
          | "options.openerphase"
          | "options.allclear_garbage"
          | "options.allclear_b2b"
          | "options.garbagespecialbonus"
          | "options.roundmode"
          | "options.allclears"
          | "options.clutch"
          | "options.nolockout"
          | "options.boardwidth"
          | "options.boardheight"
          | "options.messiness_change"
          | "options.messiness_inner"
          | "options.messiness_nosame"
          | "options.messiness_timeout"
          | "options.usebombs"

    Parameters

    Returns Promise<{
        auto: Autostart;
        creator: string;
        id: string;
        info: {};
        match: Match;
        name: string;
        name_safe: string;
        options: Options;
        owner: string;
        players: Player[];
        public: boolean;
        state: State;
        topic: {};
        type: "custom";
    }>

  • Sets the room's preset

    Parameters

    Returns Promise<{
        auto: Autostart;
        creator: string;
        id: string;
        info: {};
        match: Match;
        name: string;
        name_safe: string;
        options: Options;
        owner: string;
        players: Player[];
        public: boolean;
        state: State;
        topic: {};
        type: "custom";
    }>

    await client.room!.usePreset('tetra league (season 1)');