Skip to content

Receiving Updates by Polling

Alper Kürşat edited this page Nov 30, 2022 · 3 revisions

@botocrat/poller has been created for polling telegram api server.

The library calls .getUpdates every x miliseconds and passes updates to the bot handler(the bot variable below)

However, polling is not suggested in production because it increases use of resources and creates latency. Read Receiving Updates by Webhook instead.

import bot from "./bot.js"
import client from "./client.js"
import createPoller from "@botocrat/poller"

createPoller(bot, client, 1000).poll()
Clone this wiki locally