import { type Bot } from "../bot.js"; import { type Context } from "../context.js"; import { type FrameworkAdapter, type SupportedFrameworks } from "./frameworks.js"; export interface WebhookOptions { /** An optional strategy to handle timeouts (default: 'throw') */ onTimeout?: "throw" | "return" | ((...args: any[]) => unknown); /** An optional number of timeout milliseconds (default: 10_000) */ timeoutMilliseconds?: number; /** An optional string to compare to X-Telegram-Bot-Api-Secret-Token */ secretToken?: string; } /** * Creates a callback function that you can pass to a web framework (such as * express) if you want to run your bot via webhooks. Use it like this: * ```ts * const app = express() // or whatever you're using * const bot = new Bot('') * * app.use(webhookCallback(bot, 'express')) * ``` * * Confer the grammY * [documentation](https://grammy.dev/guide/deployment-types.html) to read more * about how to run your bot with webhooks. * * @param bot The bot for which to create a callback * @param adapter An optional string identifying the framework (default: 'express') * @param onTimeout An optional strategy to handle timeouts (default: 'throw') * @param timeoutMilliseconds An optional number of timeout milliseconds (default: 10_000) */ export declare function webhookCallback(bot: Bot, adapter?: SupportedFrameworks | FrameworkAdapter, onTimeout?: WebhookOptions["onTimeout"], timeoutMilliseconds?: WebhookOptions["timeoutMilliseconds"], secretToken?: WebhookOptions["secretToken"]): (...args: any[]) => any; export declare function webhookCallback(bot: Bot, adapter?: SupportedFrameworks | FrameworkAdapter, webhookOptions?: WebhookOptions): (...args: any[]) => any;