Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

bot.player (Actions)

Movement, emotes, reactions, and teleportation. Everything the bot or users can physically do in the room.

walk()

Moves the bot to specific coordinates with an optional facing direction.

await bot.player.walk(10, 0, 5, 'FrontLeft');
ParameterTypeDescription
xnumberX coordinate (must be >= 0)
ynumberY coordinate (must be >= 0)
znumberZ coordinate (must be >= 0)
facingFacingDirection to face (default: ‘FrontRight’)

Returns: AcknowledgmentResponse

Facing options: 'FrontRight', 'FrontLeft', 'BackRight', 'BackLeft'

sit()

Makes the bot sit on a furniture anchor.

await bot.player.sit('entity_id_here');

// sit on a specific seat
await bot.player.sit('entity_id_here', 2);
ParameterTypeDescription
entity_idstringThe furniture entity ID
anchor_ixnumberWhich seat to sit on (default: 0)

Returns: AcknowledgmentResponse

teleport()

Moves a user to specific coordinates.

await bot.player.teleport(userId, 5, 0, 5);

// with facing direction
await bot.player.teleport(userId, 5, 0, 5, 'BackRight');
ParameterTypeDescription
userIdstringID of the user to teleport
xnumberX coordinate
ynumberY coordinate
znumberZ coordinate
facingFacingDirection to face (default: ‘FrontRight’)

Returns: AcknowledgmentResponse

emote()

Sends an emote from the bot or a specific user.

// bot performs the emote
await bot.player.emote('dance-macarena');

// specific user performs the emote
await bot.player.emote('wave', userId);
ParameterTypeDescription
userIdstringUser to perform the emote (default: bot’s own ID)
emoteIdstringThe emote ID to perform

Returns: AcknowledgmentResponse

react()

Sends a reaction to a user.

await bot.player.react(userId, 'heart');
await bot.player.react(userId, 'clap');
ParameterTypeDescription
userIdstringID of the user to react to
reactionReactionsReaction type (default: ‘heart’)

Returns: AcknowledgmentResponse

Reaction options: 'clap', 'heart', 'thumbs', 'wave', 'wink'

transport()

move a user to a different room the room owner has.

await bot.player.transport(userId, 'room_id_here');
ParameterTypeDescription
userIdstringID of the user to transport
roomIdstringID of the destination room

Returns: AcknowledgmentResponse

Complete example

bot.on('Chat', async (user, message) => {
    const cmd = message.command();

    if (cmd === '!grab') {
        const target = message.mentions(0) || message.args(0);
        const targetId = target ? await bot.room.users.userId(target) : null;

        if (!targetId) {
            return; // silent fail or add an error message
        }

        const myPos = await bot.room.users.position(user.id);
        if (!myPos) return;

        await bot.player.teleport(targetId, myPos.x, myPos.y, myPos.z);
    }

    if (cmd === '!dance') {
        await bot.player.emote('dance-macarena');
        return;
    }

    if (cmd === '!wave') {
        const target = message.mentions(0) || message.args(0);

        if (target) {
            const found = await bot.room.users.find(target);
            if (found) {
                await bot.player.react(found.user.id, 'wave');
                return;
            }
        }
    }

    if (cmd === '!move') {
        const x = Number(message.args(0));
        const z = Number(message.args(1));

        if (isNaN(x) || isNaN(z)) {
            await bot.message.send('Usage: !move <x> <z>');
            return;
        }

        await bot.player.walk(x, 0, z);
        await bot.message.send(`Moving to ${x}, ${z}`);
        return;
    }
});

AcknowledgmentResponse

All action methods return this response:

{
    ok: boolean;           // true if the action succeeded
    error: string | null;  // error message if failed
    hasError(): boolean;
}

Important things to know

Coordinates must be non-negative. Passing negative values will cause validation errors before the request is sent.

Some emotes are paid The user must have them to be performed on them