INNER CODE UNIT · TypeScript

loop

grammyjs/grammY · src/bot.ts:545

    private async loop(options?: PollingOptions) {
        const limit = options?.limit;
        const timeout = options?.timeout ?? 30; // seconds
        let allowed_updates: PollingOptions["allowed_updates"] =
            options?.allowed_updates ?? []; // reset to default if unspecified

        try {
            while (this.pollingRunning) {
                // fetch updates
                const updates = await this.fetchUpdates(
                    { limit, timeout, allowed_updates },
                );
                // check if polling stopped
                if (updates === undefined) break;
                // handle updates
                await this.handleUpdates(updates);
                // Telegram uses the last setting if `allowed_updates` is omitted so
                // we can save some traffic by only sending it in the first request

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…