Documentation - v0.29.5
    Preparing search index...

    Interface TelegramWorkerOptions<T>

    interface TelegramWorkerOptions<T extends WorkerCustomMethods> {
        client: BaseTelegramClient;
        customMethods?: T;
        onLastDisconnected?:
            | "disconnect"
            | "destroy"
            | "nothing"
            | (() => "disconnect" | "destroy" | "nothing");
        workerId?: string;
    }

    Type Parameters

    Index

    Properties

    customMethods?: T

    additional custom methods to expose

    onLastDisconnected?:
        | "disconnect"
        | "destroy"
        | "nothing"
        | (() => "disconnect" | "destroy" | "nothing")

    What to do when the last connection to the worker is closed?

    • destroy: destroy the client, terminating the worker
    • disconnect: disconnect the client, but keep the worker running until forceDestroy is called
    • nothing: do nothing, lifecycle is managed manually
    • function: call this function when the last connection is closed, then execute the action returned by the function
    'nothing'
    
    workerId?: string

    mtcute worker ID to disambiguate multiple clients within the same underlying worker