Metatell AI Bot - v0.0.10
    Preparing search index...

    Interface MetatellClient

    Main client interface for interacting with Metatell services Extends VoiceCapableClient to support voice features

    interface MetatellClient {
        avatar: {
            getAvailableAnimations(): Promise<Animation[]>;
            getAvailableAssets(): Promise<AvatarAsset[]>;
            getPosition(): null | Vec3;
            lookAt(target: Vec3): Promise<void>;
            moveTo(position: Vec3): Promise<void>;
            play(animation: Animation): Promise<void>;
            rotateTo(rotation: Euler): Promise<void>;
            select(assetId: string): Promise<void>;
        };
        chat: {
            onMessage(
                handler: (
                    event: {
                        from: User;
                        mention?: { name: string; sessionId: string };
                        reply: (text: string) => Promise<void>;
                        text: string;
                    },
                ) => void,
            ): void;
            send(text: string): Promise<void>;
        };
        room: {
            getNearbyUsers(radius?: number): Promise<User[]>;
            getUsers(): Promise<User[]>;
        };
        voice: {
            playPcm(
                input: unknown,
                options: PcmInputOptions,
            ): Promise<PlaybackControls>;
        };
        connect(): Promise<void>;
        disconnect(): Promise<void>;
        getInfo(): Promise<BotInfo>;
        getRateLimit(key: "messages" | "moves" | "looks"): undefined | number;
        getSessionId(): null | string;
        getStatus(): { connected: boolean; connecting: boolean };
        getUsers(): User[];
        muteVoice?(muted: boolean): Promise<void>;
        off<E extends keyof MetatellClientEvents>(
            event: E,
            listener: MetatellClientEvents[E],
        ): this;
        on<E extends keyof MetatellClientEvents>(
            event: E,
            listener: MetatellClientEvents[E],
        ): this;
        sendVoiceFrame?(pcm: Int16Array): Promise<void>;
        setRateLimit(key: "messages" | "moves" | "looks", perSecond: number): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    avatar: {
        getAvailableAnimations(): Promise<Animation[]>;
        getAvailableAssets(): Promise<AvatarAsset[]>;
        getPosition(): null | Vec3;
        lookAt(target: Vec3): Promise<void>;
        moveTo(position: Vec3): Promise<void>;
        play(animation: Animation): Promise<void>;
        rotateTo(rotation: Euler): Promise<void>;
        select(assetId: string): Promise<void>;
    }

    Bot avatar operations

    Type Declaration

    • getAvailableAnimations: function
      • Get list of available animations for current avatar

        Returns Promise<Animation[]>

    • getAvailableAssets: function
      • Get list of available avatar assets

        Returns Promise<AvatarAsset[]>

    • getPosition: function
      • Get current position

        Returns null | Vec3

    • lookAt: function
      • Look at specified coordinates

        Parameters

        • target: Vec3

          Target coordinates to look at (meters)

        Returns Promise<void>

    • moveTo: function
      • Move to specified coordinates

        Parameters

        • position: Vec3

          Target coordinates (meters)

        Returns Promise<void>

    • play: function
      • Play animation

        Parameters

        • animation: Animation

          Animation specification to play

        Returns Promise<void>

        If specified animation doesn't exist

    • rotateTo: function
      • Rotate to specified angle

        Parameters

        • rotation: Euler

          Rotation angle (Euler angles in degrees)

        Returns Promise<void>

    • select: function
      • Select/change avatar

        Parameters

        • assetId: string

          Organization avatar ID, etc.

        Returns Promise<void>

    chat: {
        onMessage(
            handler: (
                event: {
                    from: User;
                    mention?: { name: string; sessionId: string };
                    reply: (text: string) => Promise<void>;
                    text: string;
                },
            ) => void,
        ): void;
        send(text: string): Promise<void>;
    }

    Chat-related operations

    Type Declaration

    • onMessage: function
      • Subscribe to all chat messages Receives all messages regardless of mentions

        Parameters

        • handler: (
              event: {
                  from: User;
                  mention?: { name: string; sessionId: string };
                  reply: (text: string) => Promise<void>;
                  text: string;
              },
          ) => void

        Returns void

    • send: function
      • Send message to entire room

        Parameters

        • text: string

        Returns Promise<void>

    room: {
        getNearbyUsers(radius?: number): Promise<User[]>;
        getUsers(): Promise<User[]>;
    }

    Room-related operations

    Type Declaration

    • getNearbyUsers: function
      • Get users within specified radius

        Parameters

        • Optionalradius: number

        Returns Promise<User[]>

    • getUsers: function
      • Get list of users currently in the room

        Returns Promise<User[]>

    voice: {
        playPcm(
            input: unknown,
            options: PcmInputOptions,
        ): Promise<PlaybackControls>;
    }

    Voice-related operations

    Type Declaration

    • playPcm: function
      • Inject 16-bit PCM data to make bot speak SDK internally resamples to 48kHz/mono and splits into 10ms frames

        Parameters

        • input: unknown

          Int16Array, AsyncIterable, or NodeJS.ReadableStream

        • options: PcmInputOptions

          Input PCM format

        Returns Promise<PlaybackControls>

        Object for controlling playback

        If unsupported format is specified

    Methods

    • Connect to Metatell server and join the specified room

      Returns Promise<void>

      If authentication token is invalid

      If network connection fails

    • Disconnect from the server

      Returns Promise<void>

    • Get bot's own information

      Returns Promise<BotInfo>

    • Get rate limit settings

      Parameters

      • key: "messages" | "moves" | "looks"

      Returns undefined | number

    • Get session ID for voice identification

      Returns null | string

    • Get connection status

      Returns { connected: boolean; connecting: boolean }

    • Get list of users currently in the room (sync version)

      Returns User[]

    • Mute or unmute voice

      Parameters

      • muted: boolean

      Returns Promise<void>

    • Send voice frame to the server

      Parameters

      • pcm: Int16Array

      Returns Promise<void>

    • Set rate limit

      Parameters

      • key: "messages" | "moves" | "looks"
      • perSecond: number

      Returns void