teleproto - v1.229.0
    Preparing search index...

    Interface TelegramClientParams

    Interface for creating a new client. All of these have a default value and you should only change those if you know what you are doing.

    interface TelegramClientParams {
        appVersion?: string;
        autoReconnect?: boolean;
        baseLogger?: Logger;
        channelPollInterval?: number;
        connection?: typeof Connection;
        connectionRetries?: number;
        deviceModel?: string;
        downloadPool?: Partial<MediaSchedulerOptions> & {
            idleTimeoutMs?: number;
            inflightPerDc?: number;
            maxSessions?: number;
            sessions?: number;
            sessionStartupDelayMs?: number;
        };
        downloadRetries?: number;
        entityCache?: EntityCacheOptions;
        floodSleepThreshold?: number;
        keepAliveInterval?: number;
        langCode?: string;
        maxConcurrentDownloads?: number;
        networkSocket?: SocketFactory;
        proxy?: ProxyInterface;
        reCaptchaCallback?: (siteKey: string) => Promise<string>;
        reconnectRetries?: number;
        requestRetries?: number;
        retryDelay?: number;
        securityChecks?: boolean;
        sequentialUpdates?: boolean;
        systemLangCode?: string;
        systemVersion?: string;
        testServers?: boolean;
        timeout?: number;
        useIPV6?: boolean;
    }
    Index
    appVersion?: string

    App version to be sent when creating the initial connection. Defaults to 1.0.

    autoReconnect?: boolean

    Whether reconnection should be retried connection_retries times automatically if Telegram disconnects us or not. defaults to true

    baseLogger?: Logger

    Instance of Logger to use.
    If a Logger is given, it'll be used directly. If nothing is given, the default logger will be used.
    To create your own Logger make sure you extends teleproto logger Logger and override log method.

    channelPollInterval?: number
    connection?: typeof Connection

    The connection instance to be used when creating a new connection to the servers. It must be a type.
    Defaults to ConnectionTCPFull.

    connectionRetries?: number

    How many times the connection should retry, either on the initial connection or when Telegram disconnects us.
    May be set to a negative or undefined value for infinite retries, but this is not recommended, since the program can get stuck in an infinite loop.
    defaults to 5

    deviceModel?: string

    Device model to be sent when creating the initial connection. Defaults to os.type().toString().

    downloadPool?: Partial<MediaSchedulerOptions> & {
        idleTimeoutMs?: number;
        inflightPerDc?: number;
        maxSessions?: number;
        sessions?: number;
        sessionStartupDelayMs?: number;
    }
    downloadRetries?: number

    How many times we should retry borrowing a sender from another DC when it fails. defaults to 5

    entityCache?: EntityCacheOptions

    Bounds the in-memory entity cache (the hot working set of resolved peers; the session remains the storage tier).

    omitted / true - default limit (4096 peers per user/chat segment); false - disabled, peers are resolved straight from the session store; { max?, ttl? } - explicit policy, ttl in milliseconds, { max: 0 } for an unbounded cache.

    floodSleepThreshold?: number

    The threshold below which the library should automatically sleep on flood wait and slow mode wait errors (inclusive).
    For instance, if a FloodWaitError for 17s occurs and floodSleepThreshold is 20s, the library will sleep automatically.
    If the error was for 21s, it would raise FloodWaitError instead. defaults to 60 sec.

    keepAliveInterval?: number

    TCP keep-alive probe interval in milliseconds. Defaults to 30000. Set to 0 to disable keep-alive probes.

    langCode?: string

    Language code to be sent when creating the initial connection. Defaults to 'en'.

    maxConcurrentDownloads?: number

    Limits how many downloads happen at the same time.

    networkSocket?: SocketFactory

    What type of network connection to use.

    proxy?: ProxyInterface

    Proxy configuration for routing all connections through a proxy server.

    Supports two proxy types:

    • MTProxy ({ MTProxy: true, ip, port, secret }) — Telegram's own obfuscated proxy. Automatically switches the connection to ConnectionTCPMTProxyAbridged.
    • SOCKS4/5 ({ socksType: 4 | 5, ip, port }) — general-purpose SOCKS proxy. SOCKS5 supports optional username/password authentication.

    ProxyInterface for detailed type definitions and examples.

    reCaptchaCallback?: (siteKey: string) => Promise<string>

    Callback for handling reCAPTCHA verification. It should return the token obtained after solving the CAPTCHA.

    reconnectRetries?: number

    How many times to reconnect before giving up. This happens after the initial connection is finished
    defaults to infinity

    requestRetries?: number

    How many times a request should be retried.
    Request are retried when Telegram is having internal issues (due to INTERNAL error or RPC_CALL_FAIL error),
    when there is a errors.FloodWaitError less than floodSleepThreshold, or when there's a migrate error.
    defaults to 5.

    retryDelay?: number

    The delay in milliseconds to sleep between automatic reconnections. defaults to 1000

    securityChecks?: boolean

    Whether to check for tampering in messages or not.

    sequentialUpdates?: boolean

    does nothing for now

    systemLangCode?: string

    System lang code to be sent when creating the initial connection. Defaults to 'en'.

    systemVersion?: string

    System version to be sent when creating the initial connection. defaults to os.release().toString() -.

    testServers?: boolean

    Whether to connect to Telegram's test environment instead of production.

    When true:

    • The client starts from test DC2 (149.154.167.40). DC routing follows the same path as production: help.GetConfig is the runtime source of truth, with the built-in test seed table (DC1/DC2/DC3) used as a fallback.
    • You must use a test phone number of the form 99966<dc><4 digits>; the login code is the DC digit repeated 5 times (e.g. 22222 for DC2).
    • Test sessions are not interchangeable with production sessions.

    Defaults to false.

    timeout?: number

    The timeout in seconds for establishing a TCP connection to a DC. An address that exceeds it is closed, the attempt fails fast and the next attempt rotates to an alternative address of that DC.

    useIPV6?: boolean

    Whether to connect to the servers through IPv6 or not. By default this is false.