import { type RunnerHandle } from "https://deno.land/x/grammy_runner@v2.0.3/mod.ts";
This handle gives you control over a runner. It allows you to stop the bot, start it again, and check whether it is running.
Properties
Starts the bot. Note that calling run
will automatically do this for
you, so you only have to call start
if you create a runner yourself
with createRunner
.
Stops the bot. The bot will no longer fetch updates from Telegram, and it
will interrupt the currently pending getUpdates
call.
This method returns a promise that will resolve as soon as all currently
running middleware is done executing. This means that you can await handle.stop()
to be sure that your bot really stopped completely.
Returns the size of the underlying update sink. This number is equal to the number of updates that are currently being processed. The size does not count updates that have completed, errored, or timed out.
Returns a promise that resolves as soon as the runner stops, either by
being stopped or by crashing. If the bot crashes, it means that the error
handlers installed on the bot re-threw the error, in which case the bot
terminates. A runner handle does not give you access to errors thrown by
the bot. Returns undefined
if and only if isRunning
returns false
.