Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/grammy/bot.ts>Bot#stop

The Telegram Bot Framework.
Very Popular
Latest
method Bot.prototype.stop
import { Bot } from "https://deno.land/x/grammy@v1.32.0/bot.ts";

Stops the bot from long polling.

All middleware that is currently being executed may complete, but no further getUpdates calls will be performed. The current getUpdates request will be cancelled.

In addition, this method will confirm the last received update to the Telegram servers by calling getUpdates one last time with the latest offset value. If any updates are received in this call, they are discarded and will be fetched again when the bot starts up the next time. Confer the official documentation on confirming updates if you want to know more: https://core.telegram.org/bots/api#getupdates

Note that this method will not wait for the middleware stack to finish. If you need to run code after all middleware is done, consider waiting for the promise returned by bot.start() to resolve.