telebot-ts API Documentation - v1.0.0
    Preparing search index...

    Interface RetryOptions

    Configuration options for HTTP request retry behavior and flood control.

    const bot = new Bot(process.env.BOT_TOKEN!, {
    retry: {
    maxRetryAttempts: 5,
    minDelaySeconds: 1,
    maxDelaySeconds: 60,
    retryOnStatus: [429, 500, 502, 503, 504],
    onRetry: (attempt, delayMs, error) => {
    console.warn(`Attempt ${attempt} failed with ${error.message}. Retrying in ${delayMs}ms...`);
    },
    },
    });
    interface RetryOptions {
        maxDelaySeconds?: number;
        maxRetryAttempts?: number;
        minDelaySeconds?: number;
        onRetry?: (attempt: number, delayMs: number, error: Error) => void;
        retryOnStatus?: number[];
    }
    Index
    maxDelaySeconds?: number

    Maximum backoff delay in seconds between consecutive retry attempts.

    30

    maxRetryAttempts?: number

    Maximum number of retry attempts to execute before throwing an error.

    3

    minDelaySeconds?: number

    Base delay in seconds used for the initial retry exponential backoff.

    1

    onRetry?: (attempt: number, delayMs: number, error: Error) => void

    Optional callback hook invoked before each retry attempt.

    Type Declaration

      • (attempt: number, delayMs: number, error: Error): void
      • Parameters

        • attempt: number

          The 1-based index of the failed attempt.

        • delayMs: number

          The computed delay in milliseconds before the next attempt.

        • error: Error

          The error or API response causing the retry.

        Returns void

    retryOnStatus?: number[]

    HTTP status codes that trigger an automatic retry attempt.

    [429, 500, 502, 503, 504]