import * as _gramio_callback_data from '@gramio/callback-data';
import { CallbackData } from '@gramio/callback-data';
export * from '@gramio/callback-data';
import * as _gramio_contexts from '@gramio/contexts';
import { UpdateName, MessageEventName, CustomEventName, Context, ContextsMapping, BotLike, ContextType, Attachment, AttachmentsMapping, Dice, MessageOriginUser, MessageOriginChat, MessageOriginChannel, MessageOriginHiddenUser, Message, MessageEntity, TextQuote, User, LinkPreviewOptions, ExternalReplyInfo, Chat, Giveaway, PaidMediaInfo, Game, StoryAttachment, Venue, MessageContext } from '@gramio/contexts';
export * from '@gramio/contexts';
import { FileSource, TelegramFileDownload } from '@gramio/files';
export * from '@gramio/files';
export * from '@gramio/format';
export * from '@gramio/keyboards';
import * as _gramio_types from '@gramio/types';
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, TelegramBotCommandScope, SetWebhookParams, TelegramUpdate, TelegramMessageEntity } from '@gramio/types';
export * from '@gramio/types';
import * as _gramio_composer from '@gramio/composer';
import { ComposerLike, MacroDefinitions, EventContextOf, EventComposer, MacroDef, Next, EventQueue, HandlerOptions, DeriveFromOptions } from '@gramio/composer';
export { ContextCallback, DeriveFromOptions, DeriveHandler, EventComposer, EventQueue, HandlerOptions, MacroDef, MacroDefinitions, MacroDeriveType, MacroHooks, MacroOptionType, Middleware, Next, WithCtx, WithDecorate, WithDerives, WithEventDerive, WithExtend, buildFromOptions, compose, noopNext, skip, stop } from '@gramio/composer';

/**
 * Telegram Bot API top-level update type name.
 * Valid values for `allowed_updates` in `getUpdates` / `setWebhook`.
 */
type AllowedUpdateName = Exclude<UpdateName, MessageEventName | CustomEventName>;
/** The 3 types Telegram excludes by default (must be explicitly requested). */
declare const OPT_IN_TYPES: readonly AllowedUpdateName[];
/**
 * Maps any event name to the `AllowedUpdateName` values needed in `allowed_updates`.
 *
 * - Top-level update names → themselves
 * - Sub-message events (MessageEventName) → all 5 message-carrying parent types
 * - Unknown names (filter names like "text") → `undefined` (skipped)
 */
declare function mapEventToAllowedUpdates(event: string): readonly AllowedUpdateName[] | undefined;
/**
 * Detect which of the 3 opt-in types have handlers registered.
 * Used by `bot.start()` for default auto opt-in behavior.
 */
declare function detectOptInUpdates(registeredEvents: Set<string>): AllowedUpdateName[];
/**
 * Fluent, immutable builder for the Telegram Bot API `allowed_updates` list.
 *
 * Instances directly extend `Array<AllowedUpdateName>`, so they can be passed
 * wherever `allowedUpdates` is expected without any conversion.
 *
 * @example
 * ```typescript
 * import { AllowedUpdatesFilter } from "gramio";
 *
 * // All updates (opt-in types included: chat_member, message_reaction, message_reaction_count)
 * bot.start({ allowedUpdates: AllowedUpdatesFilter.all });
 *
 * // Telegram's default set (opt-in types excluded)
 * bot.start({ allowedUpdates: AllowedUpdatesFilter.default });
 *
 * // Explicit list
 * bot.start({ allowedUpdates: AllowedUpdatesFilter.only("message", "callback_query") });
 *
 * // All except poll events
 * bot.start({ allowedUpdates: AllowedUpdatesFilter.all.except("poll", "poll_answer") });
 *
 * // Default + opt-in to chat_member
 * bot.start({ allowedUpdates: AllowedUpdatesFilter.default.add("chat_member") });
 * ```
 */
declare class AllowedUpdatesFilter extends Array<AllowedUpdateName> {
    /** @internal use static factory methods instead */
    constructor(updates: readonly AllowedUpdateName[]);
    /**
     * All update types, including the opt-in ones:
     * `chat_member`, `message_reaction`, and `message_reaction_count`.
     */
    static get all(): AllowedUpdatesFilter;
    /**
     * Telegram's **default** update set.
     *
     * Receive all updates _except_ `chat_member`, `message_reaction`, and
     * `message_reaction_count` — the three types that Telegram requires to be
     * explicitly listed in `allowed_updates`.
     *
     * This matches what Telegram does when `allowed_updates` is omitted or
     * passed as an empty array.
     */
    static get default(): AllowedUpdatesFilter;
    /**
     * Create a filter with **exactly** the specified update types.
     *
     * @example
     * ```typescript
     * AllowedUpdatesFilter.only("message", "callback_query", "inline_query")
     * ```
     */
    static only(...types: AllowedUpdateName[]): AllowedUpdatesFilter;
    /**
     * Return a new filter with the given types **added**.
     * Already-present types are silently deduplicated.
     *
     * @example
     * ```typescript
     * AllowedUpdatesFilter.default.add("chat_member", "message_reaction")
     * ```
     */
    add(...types: AllowedUpdateName[]): AllowedUpdatesFilter;
    /**
     * Return a new filter with the given types **removed**.
     *
     * @example
     * ```typescript
     * AllowedUpdatesFilter.all.except("poll", "poll_answer", "chosen_inline_result")
     * ```
     */
    except(...types: AllowedUpdateName[]): AllowedUpdatesFilter;
    /** Convert to a plain `AllowedUpdateName[]` array. */
    toArray(): AllowedUpdateName[];
}
/**
 * Build an {@link AllowedUpdatesFilter} automatically from a bot's registered
 * `.on()` handlers (including handlers from extended plugins).
 *
 * Returns **only** the update types that handlers explicitly register for.
 * Use this for strict filtering — Telegram will only send these update types.
 *
 * **Note:** filter-only `.on(filterFn, handler)` and `.use()` middleware
 * do not declare specific events and are not included.
 * Manually `.add()` additional types if needed.
 *
 * Call after all handlers/plugins are registered (or after `bot.init()`).
 *
 * @example
 * ```typescript
 * const bot = new Bot(token)
 *     .command("start", handler)
 *     .callbackQuery("data", handler);
 *
 * bot.start({ allowedUpdates: buildAllowedUpdates(bot) });
 * // → allowed_updates: ["message", "business_message", "callback_query"]
 *
 * // With customization:
 * bot.start({ allowedUpdates: buildAllowedUpdates(bot).add("poll") });
 * ```
 */
declare function buildAllowedUpdates(bot: {
    updates: {
        composer: {
            registeredEvents(): Set<string>;
        };
    };
}): AllowedUpdatesFilter;

/** Symbol to determine which error kind is it */
declare const ErrorKind: symbol;
/** Represent {@link TelegramAPIResponseError} and thrown in API calls */
declare class TelegramError<T extends keyof APIMethods> extends Error {
    /** Name of the API Method */
    method: T;
    /** Params that were sent */
    params: MaybeSuppressedParams<T>;
    /** See  {@link TelegramAPIResponseError.error_code}*/
    code: number;
    /** Describes why a request was unsuccessful. */
    payload?: TelegramResponseParameters;
    /** Construct new TelegramError */
    constructor(error: TelegramAPIResponseError, method: T, params: MaybeSuppressedParams<T>, callSite?: Error);
}

type MaybeArray<T> = T | T[] | ReadonlyArray<T>;

type TelegramEventMap = {
    [K in keyof ContextsMapping<AnyBot>]: InstanceType<ContextsMapping<AnyBot>[K]>;
};
/** Concrete context type without GetDerives (which collapses to any with AnyBot) */
type Ctx<K extends keyof ContextsMapping<AnyBot>> = InstanceType<ContextsMapping<AnyBot>[K]>;
/**
 * Extends `ComposerLike<T>` with the two internal members that method
 * bodies need: macro registry and the cross-method `chosenInlineResult` call.
 */
type GramIOLike<T> = ComposerLike<T> & {
    "~": {
        macros: MacroDefinitions;
        commandsMeta?: Map<string, unknown>;
        Derives?: Record<string, object>;
    };
    chosenInlineResult(trigger: any, handler: any, macroOptions?: any): T;
};
declare const methods: {
    reaction<TThis extends GramIOLike<TThis>>(this: TThis, trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: Ctx<"message_reaction"> & EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    callbackQuery<TThis extends GramIOLike<TThis>, Trigger extends CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: Ctx<"callback_query"> & {
        queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
    } & EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    chosenInlineResult<TThis extends GramIOLike<TThis>, Trigger extends CallbackData | RegExp | string | ((context: Ctx<"chosen_inline_result">) => boolean)>(this: TThis, trigger: Trigger, handler: (context: Ctx<"chosen_inline_result"> & {
        args: RegExpMatchArray | null;
        queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : never;
    } & EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    inlineQuery<TThis extends GramIOLike<TThis>>(this: TThis, triggerOrHandler: RegExp | string | ((context: Ctx<"inline_query">) => boolean) | ((context: Ctx<"inline_query"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "inline_query">) => unknown), maybeHandler?: (context: Ctx<"inline_query"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "inline_query">) => unknown, options?: {
        onResult?: (context: Ctx<"chosen_inline_result"> & {
            args: RegExpMatchArray | null;
        } & EventContextOf<TThis, "chosen_inline_result">) => unknown;
    } & Record<string, unknown>): TThis;
    guestQuery<TThis extends GramIOLike<TThis>>(this: TThis, triggerOrHandler: RegExp | string | ((context: Ctx<"guest_message">) => boolean) | ((context: Ctx<"guest_message"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "guest_message">) => unknown), maybeHandler?: (context: Ctx<"guest_message"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "guest_message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    hears<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: Ctx<"message">) => boolean), handler: (context: Ctx<"message"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    command<TThis extends GramIOLike<TThis>>(this: TThis, command: MaybeArray<string>, handlerOrMeta: ((context: Ctx<"message"> & {
        args: string | null;
    } & EventContextOf<TThis, "message">) => unknown) | CommandMeta, handlerOrOptions?: ((context: Ctx<"message"> & {
        args: string | null;
    } & EventContextOf<TThis, "message">) => unknown) | Record<string, unknown>, macroOptions?: Record<string, unknown>): TThis;
    startParameter<TThis extends GramIOLike<TThis>>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<Ctx<"message"> & {
        rawStartPayload: string;
    } & EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
};
/** Teach EventComposer about GramIO-specific overloads */
declare module "@gramio/composer" {
    interface EventComposer<TBase, TEventMap, TIn, TOut, TExposed, TDerives, TMethods, TMacros> {
        extend<P extends AnyPlugin>(plugin: P): EventComposer<TBase, TEventMap, TIn, TOut & P["_"]["Derives"]["global"], TExposed, TDerives & Omit<P["_"]["Derives"], "global">, TMethods, TMacros & P["_"]["Macros"]>;
        registeredEvents(): Set<string>;
        callbackQuery: (typeof methods)["callbackQuery"];
        command: (typeof methods)["command"];
        hears: (typeof methods)["hears"];
        reaction: (typeof methods)["reaction"];
        inlineQuery: (typeof methods)["inlineQuery"];
        guestQuery: (typeof methods)["guestQuery"];
        chosenInlineResult: (typeof methods)["chosenInlineResult"];
        startParameter: (typeof methods)["startParameter"];
    }
}
declare const Composer: _gramio_composer.EventComposerConstructor<Context<AnyBot>, TelegramEventMap, {
    reaction<TThis extends GramIOLike<TThis>>(this: TThis, trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: Ctx<"message_reaction"> & EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    callbackQuery<TThis extends GramIOLike<TThis>, Trigger extends CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: Ctx<"callback_query"> & {
        queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
    } & EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    chosenInlineResult<TThis extends GramIOLike<TThis>, Trigger extends CallbackData | RegExp | string | ((context: Ctx<"chosen_inline_result">) => boolean)>(this: TThis, trigger: Trigger, handler: (context: Ctx<"chosen_inline_result"> & {
        args: RegExpMatchArray | null;
        queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : never;
    } & EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    inlineQuery<TThis extends GramIOLike<TThis>>(this: TThis, triggerOrHandler: RegExp | string | ((context: Ctx<"inline_query">) => boolean) | ((context: Ctx<"inline_query"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "inline_query">) => unknown), maybeHandler?: (context: Ctx<"inline_query"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "inline_query">) => unknown, options?: {
        onResult?: (context: Ctx<"chosen_inline_result"> & {
            args: RegExpMatchArray | null;
        } & EventContextOf<TThis, "chosen_inline_result">) => unknown;
    } & Record<string, unknown>): TThis;
    guestQuery<TThis extends GramIOLike<TThis>>(this: TThis, triggerOrHandler: RegExp | string | ((context: Ctx<"guest_message">) => boolean) | ((context: Ctx<"guest_message"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "guest_message">) => unknown), maybeHandler?: (context: Ctx<"guest_message"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "guest_message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    hears<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: Ctx<"message">) => boolean), handler: (context: Ctx<"message"> & {
        args: RegExpMatchArray | null;
    } & EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
    command<TThis extends GramIOLike<TThis>>(this: TThis, command: MaybeArray<string>, handlerOrMeta: ((context: Ctx<"message"> & {
        args: string | null;
    } & EventContextOf<TThis, "message">) => unknown) | CommandMeta, handlerOrOptions?: ((context: Ctx<"message"> & {
        args: string | null;
    } & EventContextOf<TThis, "message">) => unknown) | Record<string, unknown>, macroOptions?: Record<string, unknown>): TThis;
    startParameter<TThis extends GramIOLike<TThis>>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<Ctx<"message"> & {
        rawStartPayload: string;
    } & EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
}>;

/**
 * Yields the subset of UpdateName whose context type contains all keys from Narrowing.
 */
type CompatibleUpdates$1<B extends BotLike, Narrowing> = {
    [K in UpdateName]: keyof Narrowing & string extends keyof ContextType<B, K> ? K : never;
}[UpdateName];
/**
 * `Plugin` is an object  from which you can extends in Bot instance and adopt types
 *
 * @example
 * ```ts
 * import { Plugin, Bot } from "gramio";
 *
 * export class PluginError extends Error {
 *     wow: "type" | "safe" = "type";
 * }
 *
 * const plugin = new Plugin("gramio-example")
 *     .error("PLUGIN", PluginError)
 *     .derive(() => {
 *         return {
 *             some: ["derived", "props"] as const,
 *         };
 *     });
 *
 * const bot = new Bot(process.env.TOKEN!)
 *     .extend(plugin)
 *     .onError(({ context, kind, error }) => {
 *         if (context.is("message") && kind === "PLUGIN") {
 *             console.log(error.wow);
 *         }
 *     })
 *     .use((context) => {
 *         console.log(context.some);
 *     });
 * ```
 */
declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions, Macros extends MacroDefinitions = {}> {
    /**
     * 	@internal
     * 	Set of Plugin data
     *
     *
     */
    _: {
        /** Name of plugin */
        name: string;
        /** List of plugin dependencies. If user does't extend from listed there dependencies it throw a error */
        dependencies: string[];
        /** remap generic type. {} in runtime */
        Errors: Errors;
        /** remap generic type. {} in runtime */
        Derives: Derives;
        /** remap generic type. {} in runtime */
        Macros: Macros;
        /**	Composer */
        composer: EventComposer<Context<AnyBot>, {
            callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
            chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
            chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
            my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
            chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
            delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
            group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
            inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
            invoice: _gramio_contexts.InvoiceContext<AnyBot>;
            left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
            location: _gramio_contexts.LocationContext<AnyBot>;
            managed_bot: _gramio_contexts.ManagedBotContext<AnyBot>;
            managed_bot_created: _gramio_contexts.ManagedBotCreatedContext<AnyBot>;
            message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
            message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
            channel_post: _gramio_contexts.MessageContext<AnyBot>;
            edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
            edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
            business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
            edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
            guest_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
            deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
            business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
            migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
            migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
            new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
            new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
            new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
            passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
            pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
            poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
            poll_option_added: _gramio_contexts.PollOptionAddedContext<AnyBot>;
            poll_option_deleted: _gramio_contexts.PollOptionDeletedContext<AnyBot>;
            poll: _gramio_contexts.PollContext<AnyBot>;
            pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
            proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
            write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
            boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
            chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
            checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
            checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
            direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
            suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
            suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
            suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
            suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
            suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
            forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
            forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
            forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
            forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
            general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
            general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
            shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
            successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
            refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
            users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
            chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
            gift: _gramio_contexts.GiftContext<AnyBot>;
            gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
            unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
            chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
            chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
            paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
            video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
            video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
            video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
            video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
            web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
            service_message: _gramio_contexts.MessageContext<AnyBot>;
            message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
            message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
            chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
            removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
            giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
            giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
            giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
            purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
        }, Context<AnyBot>, Context<AnyBot>, {}, {}, {
            reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }, Trigger extends _gramio_callback_data.CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.CallbackQueryContext<AnyBot> & {
                queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
            } & _gramio_composer.EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }, Trigger extends _gramio_callback_data.CallbackData | RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean)>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
                args: RegExpMatchArray | null;
                queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : never;
            } & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, triggerOrHandler: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean) | ((context: _gramio_contexts.InlineQueryContext<AnyBot> & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown), maybeHandler?: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown, options?: {
                onResult?: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
                    args: RegExpMatchArray | null;
                } & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown;
            } & Record<string, unknown>): TThis;
            guestQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, triggerOrHandler: RegExp | string | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean) | ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "guest_message">) => unknown), maybeHandler?: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "guest_message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            command<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, command: MaybeArray<string>, handlerOrMeta: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: string | null;
            } & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | CommandMeta, handlerOrOptions?: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: string | null;
            } & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | Record<string, unknown>, macroOptions?: Record<string, unknown>): TThis;
            startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                rawStartPayload: string;
            } & _gramio_composer.EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
        }, {}> & {
            reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }, Trigger extends _gramio_callback_data.CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.CallbackQueryContext<AnyBot> & {
                queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
            } & _gramio_composer.EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }, Trigger extends _gramio_callback_data.CallbackData | RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean)>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
                args: RegExpMatchArray | null;
                queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : never;
            } & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, triggerOrHandler: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean) | ((context: _gramio_contexts.InlineQueryContext<AnyBot> & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown), maybeHandler?: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown, options?: {
                onResult?: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
                    args: RegExpMatchArray | null;
                } & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown;
            } & Record<string, unknown>): TThis;
            guestQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, triggerOrHandler: RegExp | string | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean) | ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "guest_message">) => unknown), maybeHandler?: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "guest_message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: RegExpMatchArray | null;
            } & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
            command<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, command: MaybeArray<string>, handlerOrMeta: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: string | null;
            } & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | CommandMeta, handlerOrOptions?: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                args: string | null;
            } & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | Record<string, unknown>, macroOptions?: Record<string, unknown>): TThis;
            startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
                "~": {
                    macros: MacroDefinitions;
                    commandsMeta?: Map<string, unknown>;
                    Derives?: Record<string, object>;
                };
                chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
            }>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
                rawStartPayload: string;
            } & _gramio_composer.EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
        };
        /** Store plugin preRequests hooks */
        preRequests: [Hooks.PreRequest<any>, MaybeArray<keyof APIMethods> | undefined][];
        /** Store plugin onResponses hooks */
        onResponses: [Hooks.OnResponse<any>, MaybeArray<keyof APIMethods> | undefined][];
        /** Store plugin onResponseErrors hooks */
        onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray<keyof APIMethods> | undefined][];
        /** Store plugin onApiCalls hooks */
        onApiCalls: [Hooks.OnApiCall<any>, MaybeArray<keyof APIMethods> | undefined][];
        /**
         * Store plugin groups
         *
         * If you use `on` or `use` in group and on plugin-level groups handlers are registered after plugin-level handlers
         *  */
        groups: ((bot: AnyBot) => AnyBot)[];
        /** Store plugin onStarts hooks */
        onStarts: Hooks.OnStart[];
        /** Store plugin onStops hooks */
        onStops: Hooks.OnStop[];
        /** Store plugin onErrors hooks */
        onErrors: Hooks.OnError<any, any>[];
        /** Map of plugin errors */
        errorsDefinitions: Record<string, {
            new (...args: any): any;
            prototype: Error;
        }>;
        decorators: Record<string, unknown>;
    };
    /** Expose composer internals so `composer.extend(plugin)` works via duck-typing */
    get "~"(): Omit<InstanceType<typeof Composer>["~"], "Out" | "Derives"> & {
        Out: Derives["global"];
        Derives: Omit<Derives, "global">;
    };
    /** Create new Plugin. Please provide `name` */
    constructor(name: string, { dependencies }?: {
        dependencies?: string[];
    });
    /** Currently not isolated!!!
     *
     * > [!WARNING]
     * > If you use `on` or `use` in a `group` and at the plugin level, the group handlers are registered **after** the handlers at the plugin level
     */
    group(grouped: (bot: Bot<Errors, Derives>) => AnyBot): this;
    /**
     * Register custom class-error in plugin
     **/
    error<Name extends string, NewError extends {
        new (...args: any): any;
        prototype: Error;
    }>(kind: Name, error: NewError): Plugin<Errors & { [name in Name]: InstanceType<NewError>; }, Derives, Macros>;
    /**
     * Derive some data to handlers
     *
     * @example
     * ```ts
     * new Bot("token").derive((context) => {
     * 		return {
     * 			superSend: () => context.send("Derived method")
     * 		}
     * })
     * ```
     */
    derive<Handler extends Hooks.Derive<Context<BotLike> & Derives["global"]>>(handler: Handler): Plugin<Errors, Derives & {
        global: Awaited<ReturnType<Handler>>;
    }, Macros>;
    derive<Update extends UpdateName, Handler extends Hooks.Derive<ContextType<BotLike, Update> & Derives["global"] & Derives[Update]>>(updateName: MaybeArray<Update>, handler: Handler): Plugin<Errors, Derives & {
        [K in Update]: Awaited<ReturnType<Handler>>;
    }, Macros>;
    decorate<Value extends Record<string, any>>(value: Value): Plugin<Errors, Derives & {
        global: {
            [K in keyof Value]: Value[K];
        };
    }, Macros>;
    decorate<Name extends string, Value>(name: Name, value: Value): Plugin<Errors, Derives & {
        global: {
            [K in Name]: Value;
        };
    }, Macros>;
    /**
     * Register a single named macro definition on this plugin
     */
    macro<const Name extends string, TDef extends MacroDef<any, any>>(name: Name, definition: TDef): Plugin<Errors, Derives, Macros & Record<Name, TDef>>;
    /** Register multiple macro definitions at once */
    macro<const TDefs extends Record<string, MacroDef<any, any>>>(definitions: TDefs): Plugin<Errors, Derives, Macros & TDefs>;
    /** Register handler with a type-narrowing filter (auto-discovers matching events) */
    on<Narrowing>(filter: (ctx: any) => ctx is Narrowing, handler: Handler<ContextType<BotLike, CompatibleUpdates$1<BotLike, Narrowing>> & Derives["global"] & Narrowing>): this;
    /** Register handler with a boolean filter (all updates) */
    on(filter: (ctx: Context<BotLike> & Derives["global"]) => boolean, handler: Handler<Context<BotLike> & Derives["global"]>): this;
    /** Register handler to one or many Updates with a type-narrowing filter */
    on<T extends UpdateName, Narrowing>(updateName: MaybeArray<T>, filter: (ctx: any) => ctx is Narrowing, handler: Handler<ContextType<BotLike, T> & Derives["global"] & Derives[T] & Narrowing>): this;
    /** Register handler to one or many Updates with a boolean filter (no type narrowing) */
    on<T extends UpdateName>(updateName: MaybeArray<T>, filter: (ctx: ContextType<BotLike, T> & Derives["global"] & Derives[T]) => boolean, handler: Handler<ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
    /** Register handler to one or many Updates */
    on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
    /** Register handler to any Updates */
    use(handler: Handler<Context<BotLike> & Derives["global"]>): this;
    /**
     * This hook called before sending a request to Telegram Bot API (allows us to impact the sent parameters).
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).preRequest((context) => {
     *     if (context.method === "sendMessage") {
     *         context.params.text = "mutate params";
     *     }
     *
     *     return context;
     * });
     *
     * bot.start();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/pre-request.html)
     *  */
    preRequest<Methods extends keyof APIMethods, Handler extends Hooks.PreRequest<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
    preRequest(handler: Hooks.PreRequest): this;
    /**
     * This hook called when API return successful response
     *
     * [Documentation](https://gramio.dev/hooks/on-response.html)
     * */
    onResponse<Methods extends keyof APIMethods, Handler extends Hooks.OnResponse<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
    onResponse(handler: Hooks.OnResponse): this;
    /**
     * This hook called when API return an error
     *
     * [Documentation](https://gramio.dev/hooks/on-response-error.html)
     * */
    onResponseError<Methods extends keyof APIMethods, Handler extends Hooks.OnResponseError<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
    onResponseError(handler: Hooks.OnResponseError): this;
    /**
     * This hook wraps the entire API call, enabling tracing/instrumentation.
     *
     * @example
     * ```typescript
     * const plugin = new Plugin("example").onApiCall(async (context, next) => {
     *     console.log(`Calling ${context.method}`);
     *     const result = await next();
     *     console.log(`${context.method} completed`);
     *     return result;
     * });
     * ```
     *  */
    onApiCall<Methods extends keyof APIMethods, Handler extends Hooks.OnApiCall<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
    onApiCall(handler: Hooks.OnApiCall): this;
    /**
     * This hook called when the bot is `started`.
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).onStart(
     *     ({ plugins, info, updatesFrom, bot }) => {
     *         console.log(`plugin list - ${plugins.join(", ")}`);
     *         console.log(`bot username is @${info.username}`);
     * 		   console.log(`updates from ${updatesFrom}`);
     *     }
     * );
     *
     * bot.start();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/on-start.html)
     *  */
    onStart(handler: Hooks.OnStart): this;
    /**
     * This hook called when the bot stops.
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).onStop(
     *     ({ plugins, info, bot }) => {
     *         console.log(`plugin list - ${plugins.join(", ")}`);
     *         console.log(`bot username is @${info.username}`);
     *     }
     * );
     *
     * bot.start();
     * bot.stop();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/on-stop.html)
     *  */
    onStop(handler: Hooks.OnStop): this;
    /**
     * Set error handler.
     * @example
     * ```ts
     * bot.onError("message", ({ context, kind, error }) => {
     * 	return context.send(`${kind}: ${error.message}`);
     * })
     * ```
     */
    onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
    onError(handler: Hooks.OnError<Errors, Context<BotLike> & Derives["global"]>): this;
    /** Extend plugin with a Composer instance (merges middleware with deduplication) */
    extend<UExposed extends object, UDerives extends Record<string, object>>(composer: EventComposer<any, any, any, any, UExposed, UDerives>): Plugin<Errors, Derives & {
        global: UExposed;
    } & UDerives>;
    /** Extend plugin with another Plugin (merges middleware, hooks, decorators, error definitions, groups, and dependencies) */
    extend<NewPlugin extends AnyPlugin>(plugin: MaybePromise<NewPlugin>): Plugin<Errors & NewPlugin["_"]["Errors"], Derives & NewPlugin["_"]["Derives"], Macros & NewPlugin["_"]["Macros"]>;
}
interface Plugin<Errors, Derives, Macros> {
    /** Register callback query handler */
    callbackQuery: (typeof methods)["callbackQuery"];
    /** Register command handler */
    command: (typeof methods)["command"];
    /** Register text/caption pattern handler */
    hears: (typeof methods)["hears"];
    /** Register reaction handler */
    reaction: (typeof methods)["reaction"];
    /** Register inline query handler */
    inlineQuery: (typeof methods)["inlineQuery"];
    /** Register guest query (`guest_message`) handler */
    guestQuery: (typeof methods)["guestQuery"];
    /** Register chosen inline result handler */
    chosenInlineResult: (typeof methods)["chosenInlineResult"];
    /** Register deep-link parameter handler */
    startParameter: (typeof methods)["startParameter"];
}

/** Bot options that you can provide to {@link Bot} constructor */
interface BotOptions {
    /** Bot token */
    token: string;
    /** When the bot begins to listen for updates, `GramIO` retrieves information about the bot to verify if the **bot token is valid**
     * and to utilize some bot metadata. For example, this metadata will be used to strip bot mentions in commands.
     *
     * If you set it up, `GramIO` will not send a `getMe` request on startup.
     *
     * @important
     * **You should set this up when horizontally scaling your bot or working in serverless environments.**
     * */
    info?: TelegramUser;
    /** List of plugins enabled by default */
    plugins?: {
        /** Pass `false` to disable plugin. @default true */
        format?: boolean;
    };
    /** Options to configure how to send requests to the Telegram Bot API */
    api: {
        /** Configure {@link fetch} parameters */
        fetchOptions?: Parameters<typeof fetch>[1];
        /** URL which will be used to send requests to. @default "https://api.telegram.org/bot" */
        baseURL: string;
        /**
         * 	Should we send requests to `test` data center?
         * 	The test environment is completely separate from the main environment, so you will need to create a new user account and a new bot with `@BotFather`.
         *
         * 	[Documentation](https://core.telegram.org/bots/webapps#using-bots-in-the-test-environment)
         * 	@default false
         * */
        useTest?: boolean;
        /**
         * Time in milliseconds before calling {@link APIMethods.getUpdates | getUpdates} again
         * @default 1000
         */
        retryGetUpdatesWait?: number;
    };
    /**
     * File download/serving options — mainly for a **local Bot API server**.
     *
     * @example
     * ```ts
     * const bot = new Bot(token, {
     *     api: { baseURL: "http://telegram-bot-api:8081/bot" },
     *     files: {
     *         // bot.getFileLink() and ctx.download() resolve to this (token-less) URL
     *         baseURL: "http://telegram-bot-api:8080",
     *     },
     * });
     * ```
     */
    files?: {
        /** How to fetch file bytes. @default "auto" */
        source?: FileSource;
        /** Working directory of the local Bot API server — the prefix of the absolute `file_path` it returns. @default "/var/lib/telegram-bot-api" */
        localDir?: string;
        /** Where that working dir is mounted on the bot's side (for `source: "disk"` when bot & server share a volume at a different path). Defaults to `localDir`. */
        mountDir?: string;
        /** Public base URL where the working dir is served (e.g. the bundled file server / nginx). Enables token-less {@link Bot.getFileLink} and `source: "rewrite"`. */
        baseURL?: string;
    };
}
/**
 * Handler is a function with context and next function arguments
 *
 * @example
 * ```ts
 * const handler: Handler<ContextType<Bot, "message">> = (context, _next) => context.send("HI!");
 *
 * bot.on("message", handler)
 * ```
 */
type Handler<T> = (context: T, next: Next) => unknown;
interface ErrorHandlerParams<Ctx extends Context<AnyBot>, Kind extends string, Err> {
    context: Ctx;
    kind: Kind;
    error: Err;
}
type AnyTelegramError<Methods extends keyof APIMethods = keyof APIMethods> = {
    [APIMethod in Methods]: TelegramError<APIMethod>;
}[Methods];
type AnyTelegramMethod<Methods extends keyof APIMethods> = {
    [APIMethod in Methods]: {
        method: APIMethod;
        params: MaybeSuppressedParams<APIMethod>;
    };
}[Methods];
/**
 * Interface for add `suppress` param to params
 */
interface Suppress<IsSuppressed extends boolean | undefined = undefined> {
    /**
     * Pass `true` if you want to suppress throwing errors of this method.
     *
     * **But this does not undo getting into the `onResponseError` hook**.
     *
     * @example
     * ```ts
     * const response = await bot.api.sendMessage({
     * 		suppress: true,
     * 		chat_id: "@not_found",
     * 		text: "Suppressed method"
     * });
     *
     * if(response instanceof TelegramError) console.error("sendMessage returns an error...")
     * else console.log("Message has been sent successfully");
     * ```
     *
     * */
    suppress?: IsSuppressed;
}
/** Type that assign API params with {@link Suppress} */
type MaybeSuppressedParams<Method extends keyof APIMethods, IsSuppressed extends boolean | undefined = undefined> = APIMethodParams<Method> & Suppress<IsSuppressed>;
/** Return method params but with {@link Suppress} */
type SuppressedAPIMethodParams<Method extends keyof APIMethods> = undefined extends APIMethodParams<Method> ? Suppress<true> : MaybeSuppressedParams<Method, true>;
/** Type that return MaybeSuppressed API method ReturnType */
type MaybeSuppressedReturn<Method extends keyof APIMethods, IsSuppressed extends boolean | undefined = undefined> = true extends IsSuppressed ? TelegramError<Method> | APIMethodReturn<Method> : APIMethodReturn<Method>;
/** Type that return {@link Suppress | Suppressed} API method ReturnType */
type SuppressedAPIMethodReturn<Method extends keyof APIMethods> = MaybeSuppressedReturn<Method, true>;
/** Map of APIMethods but with {@link Suppress} */
type SuppressedAPIMethods<Methods extends keyof APIMethods = keyof APIMethods> = {
    [APIMethod in Methods]: APIMethodParams<APIMethod> extends undefined ? <IsSuppressed extends boolean | undefined = undefined>(params?: Suppress<IsSuppressed>) => Promise<MaybeSuppressedReturn<APIMethod, IsSuppressed>> : undefined extends APIMethodParams<APIMethod> ? <IsSuppressed extends boolean | undefined = undefined>(params?: MaybeSuppressedParams<APIMethod, IsSuppressed>) => Promise<MaybeSuppressedReturn<APIMethod, IsSuppressed>> : <IsSuppressed extends boolean | undefined = undefined>(params: MaybeSuppressedParams<APIMethod, IsSuppressed>) => Promise<MaybeSuppressedReturn<APIMethod, IsSuppressed>>;
};
type AnyTelegramMethodWithReturn<Methods extends keyof APIMethods> = {
    [APIMethod in Methods]: {
        method: APIMethod;
        params: APIMethodParams<APIMethod>;
        response: APIMethodReturn<APIMethod>;
    };
}[Methods];
/** Type for maybe {@link Promise} or may not */
type MaybePromise<T> = Promise<T> | T;
/**
 * Namespace with GramIO hooks types
 *
 * [Documentation](https://gramio.dev/hooks/overview.html)
 * */
declare namespace Hooks {
    /** Derive */
    type Derive<Ctx> = (context: Ctx) => MaybePromise<Record<string, unknown>>;
    /** Argument type for {@link PreRequest} */
    type PreRequestContext<Methods extends keyof APIMethods> = AnyTelegramMethod<Methods>;
    /**
     * Type for `preRequest` hook
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).preRequest((context) => {
     *     if (context.method === "sendMessage") {
     *         context.params.text = "mutate params";
     *     }
     *
     *     return context;
     * });
     *
     * bot.start();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/pre-request.html)
     *  */
    type PreRequest<Methods extends keyof APIMethods = keyof APIMethods> = (ctx: PreRequestContext<Methods>) => MaybePromise<PreRequestContext<Methods>>;
    /** Argument type for {@link OnError} */
    type OnErrorContext<Ctx extends Context<AnyBot>, T extends ErrorDefinitions> = ErrorHandlerParams<Ctx, "TELEGRAM", AnyTelegramError> | ErrorHandlerParams<Ctx, "UNKNOWN", Error> | {
        [K in keyof T]: ErrorHandlerParams<Ctx, K & string, T[K & string]>;
    }[keyof T];
    /**
     * Type for `onError` hook
     *
     * @example
     * ```typescript
     * bot.on("message", () => {
     *     bot.api.sendMessage({
     *         chat_id: "@not_found",
     *         text: "Chat not exists....",
     *     });
     * });
     *
     * bot.onError(({ context, kind, error }) => {
     *     if (context.is("message")) return context.send(`${kind}: ${error.message}`);
     * });
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/on-error.html)
     *  */
    type OnError<T extends ErrorDefinitions, Ctx extends Context<any> = Context<AnyBot>> = (options: OnErrorContext<Ctx, T>) => unknown;
    /**
     * Type for `onStart` hook
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).onStart(
     *     ({ plugins, info, updatesFrom, bot }) => {
     *         console.log(`plugin list - ${plugins.join(", ")}`);
     *         console.log(`bot username is @${info.username}`);
     * 		   console.log(`updates from ${updatesFrom}`);
     *     }
     * );
     *
     * bot.start();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/on-start.html)
     *  */
    type OnStart = (context: {
        plugins: string[];
        info: TelegramUser;
        updatesFrom: "webhook" | "long-polling";
        bot: BotLike;
    }) => unknown;
    /**
     * Type for `onStop` hook
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).onStop(
     *     ({ plugins, info, bot }) => {
     *         console.log(`plugin list - ${plugins.join(", ")}`);
     *         console.log(`bot username is @${info.username}`);
     *     }
     * );
     *
     * bot.start();
     * bot.stop();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/on-stop.html)
     *  */
    type OnStop = (context: {
        plugins: string[];
        info: TelegramUser;
        bot: BotLike;
    }) => unknown;
    /**
     * Type for `onResponseError` hook
     *
     * [Documentation](https://gramio.dev/hooks/on-response-error.html)
     * */
    type OnResponseError<Methods extends keyof APIMethods = keyof APIMethods> = (context: AnyTelegramError<Methods>, api: Bot["api"]) => unknown;
    /**
     * Type for `onResponse` hook
     *
     * [Documentation](https://gramio.dev/hooks/on-response.html)
     *  */
    type OnResponse<Methods extends keyof APIMethods = keyof APIMethods> = (context: AnyTelegramMethodWithReturn<Methods>) => unknown;
    /** Argument type for {@link OnApiCall} */
    type OnApiCallContext<Methods extends keyof APIMethods> = AnyTelegramMethod<Methods>;
    /**
     * Type for `onApiCall` hook (wrap-style)
     *
     * This hook wraps the entire API call execution, enabling span creation
     * around API calls for tracing/instrumentation.
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).onApiCall(async (context, next) => {
     *     console.log(`Calling ${context.method}`);
     *     const result = await next();
     *     console.log(`${context.method} completed`);
     *     return result;
     * });
     * ```
     *  */
    type OnApiCall<Methods extends keyof APIMethods = keyof APIMethods> = (context: OnApiCallContext<Methods>, next: () => Promise<unknown>) => Promise<unknown>;
    /** Store hooks */
    interface Store<T extends ErrorDefinitions> {
        preRequest: PreRequest[];
        onResponse: OnResponse[];
        onResponseError: OnResponseError[];
        onError: OnError<T>[];
        onStart: OnStart[];
        onStop: OnStop[];
        onApiCall: OnApiCall[];
    }
}
/** Error map should be map of string: error */
type ErrorDefinitions = Record<string, Error>;
/** Map of derives */
type DeriveDefinitions = Record<UpdateName | "global", {}>;
/** Type of Bot that accepts any generics */
type AnyBot = Bot<any, any, any>;
/** Type of Bot that accepts any generics */
type AnyPlugin = Plugin<any, any, any>;
type CallbackQueryShorthandContext<BotType extends BotLike, Trigger extends CallbackData | string | RegExp> = Omit<ContextType<BotType, "callback_query">, "data"> & BotType["__Derives"]["global"] & BotType["__Derives"]["callback_query"] & {
    queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
};
type BotStartOptionsLongPolling = Omit<NonNullable<APIMethodParams<"getUpdates">>, "allowed_updates" | "offset">;
type BotStartOptionsWebhook = true | string | Omit<SetWebhookParams, "drop_pending_updates" | "allowed_updates">;
type AllowedUpdates = Exclude<NonNullable<APIMethodParams<"getUpdates">>["allowed_updates"], "update_id">;
interface BotStartOptions {
    webhook?: BotStartOptionsWebhook;
    longPolling?: BotStartOptionsLongPolling;
    dropPendingUpdates?: boolean;
    /**
     * Which update types to receive from Telegram.
     *
     * - **`undefined`** (default) — Telegram's default set, plus automatic opt-in
     *   for `chat_member`, `message_reaction`, and `message_reaction_count` if
     *   the bot has handlers registered for them.
     * - **`"strict"`** — only receive update types that handlers explicitly
     *   register for via `.on()`. Equivalent to `AllowedUpdatesFilter.from(bot)`.
     *   Filter-only `.on()` and `.use()` are not included.
     * - **`AllowedUpdatesFilter` / array** — explicit list of update types.
     *
     * @example
     * ```typescript
     * // Auto opt-in (default): Telegram default + auto chat_member/reaction if needed
     * bot.start();
     *
     * // Strict: only registered events
     * bot.start({ allowedUpdates: "strict" });
     *
     * // Manual
     * bot.start({ allowedUpdates: AllowedUpdatesFilter.all });
     *
     * // Strict + customize
     * bot.start({ allowedUpdates: AllowedUpdatesFilter.from(bot).add("poll") });
     * ```
     */
    allowedUpdates?: AllowedUpdates | "strict";
    deleteWebhook?: boolean | "on-conflict-with-polling";
}
interface PollingStartOptions {
    dropPendingUpdates?: boolean;
    deleteWebhookOnConflict?: boolean;
}
/** Shorthand strings for common BotCommandScope types */
type ScopeShorthand = "default" | "all_private_chats" | "all_group_chats" | "all_chat_administrators";
/**
 * Metadata for a bot command, used by `syncCommands()` to push
 * descriptions, localized names, and visibility scopes to the Telegram API.
 */
interface CommandMeta {
    /** Command description shown in the Telegram menu (1-256 chars) */
    description: string;
    /** Localized descriptions keyed by IETF language tag */
    locales?: Record<string, string>;
    /** Where this command is visible. Default: `["default"]` */
    scopes?: (TelegramBotCommandScope | ScopeShorthand)[];
    /** Exclude this command from `syncCommands()`. The handler still works. @default false */
    hide?: boolean;
}
/** Minimal key-value storage interface compatible with `@gramio/storage` */
interface SyncStorage {
    get(key: string): string | undefined | Promise<string | undefined>;
    set(key: string, value: string): void | Promise<void>;
}
/** Options for {@link Bot.syncCommands} */
interface SyncCommandsOptions {
    /** Storage for caching sync hashes. When provided, only changed groups trigger API calls. */
    storage?: SyncStorage;
    /** Delete commands for scopes not declared by any command. @default false */
    cleanUnusedScopes?: boolean;
    /** Command names to exclude from syncing (in addition to commands with `hide: true`) */
    exclude?: string[];
}

declare class Updates {
    private readonly bot;
    isStarted: boolean;
    isRequestActive: boolean;
    private offset;
    composer: InstanceType<typeof Composer>;
    queue: EventQueue<TelegramUpdate>;
    stopPollingPromiseResolve: ((value?: undefined) => void) | undefined;
    constructor(bot: AnyBot, onError: (context: Context<any>, error: Error) => unknown);
    handleUpdate(data: TelegramUpdate): Promise<void>;
    /** @deprecated use bot.start instead @internal */
    startPolling(params?: APIMethodParams<"getUpdates">, options?: PollingStartOptions): void;
    startFetchLoop(params?: APIMethodParams<"getUpdates">, options?: PollingStartOptions): Promise<void>;
    dropPendingUpdates(deleteWebhookOnConflict?: boolean): Promise<void>;
    /**
     * ! Soon waitPendingRequests param default will changed to true
     */
    stopPolling(waitPendingRequests?: boolean): Promise<void>;
}

/**
 * Yields the subset of UpdateName whose context type contains all keys from Narrowing.
 * Used to give filter-only .on() handlers a rich union type instead of the bare Context base class.
 */
type CompatibleUpdates<B extends BotLike, Narrowing> = {
    [K in UpdateName]: keyof Narrowing & string extends keyof ContextType<B, K> ? K : never;
}[UpdateName];
/** Bot instance
 *
 * @example
 * ```ts
 * import { Bot } from "gramio";
 *
 * const bot = new Bot("") // put you token here
 *     .command("start", (context) => context.send("Hi!"))
 *     .onStart(console.log);
 *
 * bot.start();
 * ```
 */
declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions, Macros extends MacroDefinitions = {}> {
    /** @deprecated use `~` instead*/
    _: {
        /** @deprecated @internal. Remap generic */
        derives: Derives;
    };
    /** @deprecated use `~.derives` instead @internal. Remap generic */
    __Derives: Derives;
    "~": {
        /** @deprecated @internal. Remap generic */
        derives: Derives;
    };
    /** Options provided to instance */
    readonly options: BotOptions;
    /** Bot data (filled in when calling bot.init/bot.start) */
    info: TelegramUser | undefined;
    /**
     * Send API Request to Telegram Bot API
     *
     * @example
     * ```ts
     * const response = await bot.api.sendMessage({
     *     chat_id: "@gramio_forum",
     *     text: "some text",
     * });
     * ```
     *
     * [Documentation](https://gramio.dev/bot-api.html)
     */
    readonly api: SuppressedAPIMethods;
    private lazyloadPlugins;
    private dependencies;
    private errorsDefinitions;
    private errorHandler;
    /** This instance handle updates */
    updates: Updates;
    private hooks;
    constructor(token: string, options?: Omit<BotOptions, "token" | "api"> & {
        api?: Partial<BotOptions["api"]>;
    });
    constructor(options: Omit<BotOptions, "api"> & {
        api?: Partial<BotOptions["api"]>;
    });
    private runHooks;
    private runImmutableHooks;
    private _callApi;
    /**
     * Download file
     *
     * @example
     * ```ts
     * bot.on("message", async (context) => {
     *     if (!context.document) return;
     *     // download to ./file-name
     *     await context.download(context.document.fileName || "file-name");
     *     // get ArrayBuffer
     *     const buffer = await context.download();
     *
     *     return context.send("Thank you!");
     * });
     * ```
     * [Documentation](https://gramio.dev/files/download.html)
     */
    downloadFile(attachment: Attachment | {
        file_id: string;
    } | string): TelegramFileDownload;
    downloadFile(attachment: Attachment | {
        file_id: string;
    } | string, path: string): Promise<string>;
    /**
     * Get a shareable download link for a file.
     *
     * When {@link BotOptions.files | `files.baseURL`} is set (e.g. a local Bot API
     * server with the bundled file server), the link is **token-less and path-based**
     * — safe to hand to users. Otherwise it falls back to the classic
     * `…/file/bot<token>/<path>` URL (which contains the bot token).
     *
     * @example
     * ```ts
     * const link = await bot.getFileLink(ctx.document.fileId);
     * await ctx.reply(`Download: ${link}`);
     * ```
     */
    getFileLink(attachment: Attachment | {
        file_id: string;
    } | string): Promise<string>;
    /**
     * Register custom class-error for type-safe catch in `onError` hook
     *
     * @example
     * ```ts
     * export class NoRights extends Error {
     *     needRole: "admin" | "moderator";
     *
     *     constructor(role: "admin" | "moderator") {
     *         super();
     *         this.needRole = role;
     *     }
     * }
     *
     * const bot = new Bot(process.env.TOKEN!)
     *     .error("NO_RIGHTS", NoRights)
     *     .onError(({ context, kind, error }) => {
     *         if (context.is("message") && kind === "NO_RIGHTS")
     *             return context.send(
     *                 format`You don't have enough rights! You need to have an «${bold(
     *                     error.needRole
     *                 )}» role.`
     *             );
     *     });
     *
     * bot.updates.on("message", (context) => {
     *     if (context.text === "bun") throw new NoRights("admin");
     * });
     * ```
     */
    error<Name extends string, NewError extends {
        new (...args: any): any;
        prototype: Error;
    }>(kind: Name, error: NewError): Bot<Errors & { [name in Name]: InstanceType<NewError>; }, Derives, Macros>;
    /**
     * Set error handler.
     * @example
     * ```ts
     * bot.onError("message", ({ context, kind, error }) => {
     * 	return context.send(`${kind}: ${error.message}`);
     * })
     * ```
     */
    onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<typeof this, T>>): this;
    onError(handler: Hooks.OnError<Errors, Context<typeof this> & Derives["global"]>): this;
    /**
     * Derive some data to handlers
     *
     * @example
     * ```ts
     * new Bot("token").derive((context) => {
     * 		return {
     * 			superSend: () => context.send("Derived method")
     * 		}
     * })
     * ```
     */
    derive<Handler extends Hooks.Derive<Context<typeof this> & Derives["global"]>>(handler: Handler): Bot<Errors, Derives & {
        global: Awaited<ReturnType<Handler>>;
    }, Macros>;
    derive<Update extends UpdateName, Handler extends Hooks.Derive<ContextType<typeof this, Update> & Derives["global"] & Derives[Update]>>(updateName: MaybeArray<Update>, handler: Handler): Bot<Errors, Derives & {
        [K in Update]: Awaited<ReturnType<Handler>>;
    }, Macros>;
    decorate<Value extends Record<string, any>>(value: Value): Bot<Errors, Derives & {
        global: {
            [K in keyof Value]: Value[K];
        };
    }, Macros>;
    decorate<Name extends string, Value>(name: Name, value: Value): Bot<Errors, Derives & {
        global: {
            [K in Name]: Value;
        };
    }, Macros>;
    /**
     * Register a single named macro definition
     *
     * @example
     * ```ts
     * import { Bot, type MacroDef } from "gramio";
     *
     * const onlyAdmin: MacroDef = {
     *   preHandler: (ctx, next) => {
     *     if (ctx.from?.id !== ADMIN_ID) return;
     *     return next();
     *   },
     * };
     *
     * const bot = new Bot(process.env.TOKEN!)
     *   .macro("onlyAdmin", onlyAdmin)
     *   .command("ban", handler, { onlyAdmin: true });
     * ```
     */
    macro<const Name extends string, TDef extends MacroDef<any, any>>(name: Name, definition: TDef): Bot<Errors, Derives, Macros & Record<Name, TDef>>;
    /** Register multiple macro definitions at once */
    macro<const TDefs extends Record<string, MacroDef<any, any>>>(definitions: TDefs): Bot<Errors, Derives, Macros & TDefs>;
    /**
     * This hook called when the bot is `started`.
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).onStart(
     *     ({ plugins, info, updatesFrom, bot }) => {
     *         console.log(`plugin list - ${plugins.join(", ")}`);
     *         console.log(`bot username is @${info.username}`);
     * 		   console.log(`updates from ${updatesFrom}`);
     *     }
     * );
     *
     * bot.start();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/on-start.html)
     *  */
    onStart(handler: Hooks.OnStart): this;
    /**
     * This hook called when the bot stops.
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).onStop(
     *     ({ plugins, info, bot }) => {
     *         console.log(`plugin list - ${plugins.join(", ")}`);
     *         console.log(`bot username is @${info.username}`);
     *     }
     * );
     *
     * bot.start();
     * bot.stop();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/on-stop.html)
     *  */
    onStop(handler: Hooks.OnStop): this;
    /**
     * This hook called before sending a request to Telegram Bot API (allows us to impact the sent parameters).
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).preRequest((context) => {
     *     if (context.method === "sendMessage") {
     *         context.params.text = "mutate params";
     *     }
     *
     *     return context;
     * });
     *
     * bot.start();
     * ```
     *
     * [Documentation](https://gramio.dev/hooks/pre-request.html)
     *  */
    preRequest<Methods extends keyof APIMethods, Handler extends Hooks.PreRequest<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
    preRequest(handler: Hooks.PreRequest): this;
    /**
     * This hook called when API return successful response
     *
     * [Documentation](https://gramio.dev/hooks/on-response.html)
     * */
    onResponse<Methods extends keyof APIMethods, Handler extends Hooks.OnResponse<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
    onResponse(handler: Hooks.OnResponse): this;
    /**
     * This hook called when API return an error
     *
     * [Documentation](https://gramio.dev/hooks/on-response-error.html)
     * */
    onResponseError<Methods extends keyof APIMethods, Handler extends Hooks.OnResponseError<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
    onResponseError(handler: Hooks.OnResponseError): this;
    /**
     * This hook wraps the entire API call, enabling tracing/instrumentation.
     *
     * @example
     * ```typescript
     * import { Bot } from "gramio";
     *
     * const bot = new Bot(process.env.TOKEN!).onApiCall(async (context, next) => {
     *     console.log(`Calling ${context.method}`);
     *     const result = await next();
     *     console.log(`${context.method} completed`);
     *     return result;
     * });
     * ```
     *  */
    onApiCall<Methods extends keyof APIMethods, Handler extends Hooks.OnApiCall<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
    onApiCall(handler: Hooks.OnApiCall): this;
    /** Register handler with a type-narrowing filter (auto-discovers matching events) */
    on<Narrowing>(filter: (ctx: any) => ctx is Narrowing, handler: Handler<ContextType<typeof this, CompatibleUpdates<typeof this, Narrowing>> & Derives["global"] & Narrowing>): this;
    /** Register handler with a boolean filter (all updates) */
    on(filter: (ctx: Context<typeof this> & Derives["global"]) => boolean, handler: Handler<Context<typeof this> & Derives["global"]>): this;
    /** Register handler to one or many Updates with a type-narrowing filter */
    on<T extends UpdateName, Narrowing>(updateName: MaybeArray<T>, filter: (ctx: any) => ctx is Narrowing, handler: Handler<ContextType<typeof this, T> & Narrowing>): this;
    /** Register handler to one or many Updates with a boolean filter (no type narrowing) */
    on<T extends UpdateName>(updateName: MaybeArray<T>, filter: (ctx: ContextType<typeof this, T>) => boolean, handler: Handler<ContextType<typeof this, T>>): this;
    /** Register handler to one or many Updates */
    on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<typeof this, T>>): this;
    /** Register handler to any Updates */
    use(handler: Handler<Context<typeof this> & Derives["global"]>): this;
    /**
     * Extend {@link Plugin} logic and types
     *
     * @example
     * ```ts
     * import { Plugin, Bot } from "gramio";
     *
     * export class PluginError extends Error {
     *     wow: "type" | "safe" = "type";
     * }
     *
     * const plugin = new Plugin("gramio-example")
     *     .error("PLUGIN", PluginError)
     *     .derive(() => {
     *         return {
     *             some: ["derived", "props"] as const,
     *         };
     *     });
     *
     * const bot = new Bot(process.env.TOKEN!)
     *     .extend(plugin)
     *     .onError(({ context, kind, error }) => {
     *         if (context.is("message") && kind === "PLUGIN") {
     *             console.log(error.wow);
     *         }
     *     })
     *     .use((context) => {
     *         console.log(context.some);
     *     });
     * ```
     */
    extend<UExposed extends object, UDerives extends Record<string, object>>(composer: EventComposer<any, any, any, any, UExposed, UDerives, any, any>): Bot<Errors, Derives & {
        global: UExposed;
    } & UDerives, Macros>;
    extend<NewPlugin extends AnyPlugin>(plugin: MaybePromise<NewPlugin>): Bot<Errors & NewPlugin["_"]["Errors"], Derives & NewPlugin["_"]["Derives"], Macros & NewPlugin["_"]["Macros"]>;
    /**
     * Register handler to reaction (`message_reaction` update)
     *
     * @example
     * ```ts
     * new Bot().reaction("👍", async (context) => {
     *     await context.reply(`Thank you!`);
     * });
     * ```
     * */
    reaction<TOptions extends HandlerOptions<ContextType<typeof this, "message_reaction">, Macros> = {}>(trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: ContextType<typeof this, "message_reaction"> & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
    /**
     * Register handler to `callback_query` event
     *
     * @example
     * ```ts
     * const someData = new CallbackData("example").number("id");
     *
     * new Bot()
     *     .command("start", (context) =>
     *         context.send("some", {
     *             reply_markup: new InlineKeyboard().text(
     *                 "example",
     *                 someData.pack({
     *                     id: 1,
     *                 })
     *             ),
     *         })
     *     )
     *     .callbackQuery(someData, (context) => {
     *         context.queryData; // is type-safe
     *     });
     * ```
     */
    callbackQuery<Trigger extends CallbackData | string | RegExp, TOptions extends HandlerOptions<CallbackQueryShorthandContext<typeof this, Trigger>, Macros> = {}>(trigger: Trigger, handler: (context: CallbackQueryShorthandContext<typeof this, Trigger> & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
    /**
     * Register handler to `chosen_inline_result` update
     *
     * Accepts a `CallbackData` schema for type-safe filtering on `result_id`:
     *
     * @example
     * ```ts
     * const trackRef = new CallbackData("track").string("src").string("id");
     *
     * new Bot()
     *     .on("inline_query", async (ctx) => {
     *         await ctx.answer(tracks.map((t) => ({
     *             type: "audio",
     *             id: trackRef.pack({ src: t.source, id: t.id }),
     *             audio_url: t.url,
     *             title: t.title,
     *         })));
     *     })
     *     .chosenInlineResult(trackRef, (ctx) => {
     *         ctx.queryData; // { src: string; id: string }
     *     });
     * ```
     *
     * String/RegExp/predicate triggers filter on `context.query` (the user's
     * typed text); the `CallbackData` schema filters on `context.resultId`.
     */
    chosenInlineResult<Trigger extends CallbackData | RegExp | string | ((context: ContextType<typeof this, "chosen_inline_result">) => boolean), Ctx = ContextType<typeof this, "chosen_inline_result">, TOptions extends HandlerOptions<Ctx, Macros> = {}>(trigger: Trigger, handler: (context: Ctx & {
        args: RegExpMatchArray | null;
        queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : never;
    } & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
    /**
     * Register handler to `inline_query` update
     *
     * @example
     * ```ts
     * new Bot().inlineQuery(
     *     /regular expression with (.*)/i,
     *     async (context) => {
     *         if (context.args) {
     *             await context.answer(
     *                 [
     *                     InlineQueryResult.article(
     *                         "id-1",
     *                         context.args[1],
     *                         InputMessageContent.text("some"),
     *                         {
     *                             reply_markup: new InlineKeyboard().text(
     *                                 "some",
     *                                 "callback-data"
     *                             ),
     *                         }
     *                     ),
     *                 ],
     *                 {
     *                     cache_time: 0,
     *                 }
     *             );
     *         }
     *     },
     *     {
     *         onResult: (context) => context.editText("Message edited!"),
     *     }
     * );
     * ```
     * */
    inlineQuery<Ctx = ContextType<typeof this, "inline_query">>(handler: (context: Ctx & {
        args: RegExpMatchArray | null;
    }) => unknown): this;
    inlineQuery<Ctx = ContextType<typeof this, "inline_query">>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
        args: RegExpMatchArray | null;
    }) => unknown, options?: HandlerOptions<Ctx, Macros> & {
        onResult?: (context: ContextType<Bot, "chosen_inline_result"> & {
            args: RegExpMatchArray | null;
        }) => unknown;
    }): this;
    /**
     * Register handler to `guest_message` update — a message sent to the bot
     * from a chat where the bot is not a member, via a guest query.
     *
     * Reply with {@link MessageContext.answerGuestQuery `context.answerGuestQuery()`}
     * (NOT `context.send`/`context.reply`, which target a chat the bot can't post to).
     *
     * @example
     * ```ts
     * new Bot().guestQuery(/^find (.*)/i, async (context) => {
     *     await context.answerGuestQuery({
     *         type: "text",
     *         text: `Looking up ${context.args?.[1]}…`,
     *     });
     * });
     *
     * // No-trigger form — match any guest message:
     * new Bot().guestQuery(async (context) => {
     *     await context.answerGuestQuery({ type: "text", text: "Hi!" });
     * });
     * ```
     * */
    guestQuery<Ctx = ContextType<typeof this, "guest_message">>(handler: (context: Ctx & {
        args: RegExpMatchArray | null;
    }) => unknown): this;
    guestQuery<Ctx = ContextType<typeof this, "guest_message">>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
        args: RegExpMatchArray | null;
    }) => unknown, options?: HandlerOptions<Ctx, Macros>): this;
    /**
     * Register handler to `message` and `business_message` event
     *
     * @example
     * ```ts
     * new Bot().hears(/regular expression with (.*)/i, async (context) => {
     *     if (context.args) await context.send(`Params ${context.args[1]}`);
     * });
     * ```
     */
    hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | MaybeArray<string> | ((context: Ctx) => boolean) = RegExp | MaybeArray<string> | ((context: Ctx) => boolean), TOptions extends HandlerOptions<Ctx, Macros> = {}>(trigger: Trigger, handler: (context: Ctx & {
        args: RegExpMatchArray | null;
    } & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
    /**
     * Register handler to `message` and `business_message` event when entities contains a command
     *
     * @example
     * ```ts
     * new Bot().command("start", async (context) => {
     *     return context.send(`You message is /start ${context.args}`);
     * });
     * ```
     *
     * @example
     * ```ts
     * // With metadata — description will be synced via syncCommands()
     * new Bot().command("start", {
     *     description: "Start the bot",
     *     locales: { ru: "Запустить бота" },
     * }, (context) => context.send("Hello!"));
     * ```
     */
    command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, handler: (context: ContextType<typeof this, "message"> & {
        args: string | null;
    } & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): typeof this;
    command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, meta: CommandMeta, handler: (context: ContextType<typeof this, "message"> & {
        args: string | null;
    } & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): typeof this;
    /**
     * Register handler to `start` command when start parameter is matched
     *
     * @example
     * ```ts
     * new Bot().startParameter(/^ref_(.+)$/, (context) => {
     *     return context.send(`Reference: ${context.rawStartPayload}`);
     * });
     * ```
     */
    startParameter<TOptions extends HandlerOptions<ContextType<typeof this, "message"> & {
        rawStartPayload: string;
    }, Macros> = {}>(parameter: RegExp | MaybeArray<string>, handler: Handler<ContextType<typeof this, "message"> & {
        rawStartPayload: string;
    } & DeriveFromOptions<Macros, TOptions>>, options?: TOptions): this;
    /** Currently not isolated!!! */
    group(grouped: (bot: typeof this) => AnyBot): typeof this;
    /**
     * Sync registered command metadata with the Telegram API.
     *
     * Groups commands by `{scope, language_code}` and calls `setMyCommands` for each group.
     * When a `storage` is provided, hashes each payload and skips unchanged groups.
     *
     * @example
     * ```ts
     * bot.onStart(() => bot.syncCommands());
     * ```
     */
    syncCommands(options?: SyncCommandsOptions): Promise<void>;
    /**
     * Init bot. Call it manually only if you doesn't use {@link Bot.start}
     */
    init(): Promise<void>;
    /**
     * Start receive updates via long-polling or webhook
     *
     * @example
     * ```ts
     * import { Bot } from "gramio";
     *
     * const bot = new Bot("") // put you token here
     *     .command("start", (context) => context.send("Hi!"))
     *     .onStart(console.log);
     *
     * bot.start();
     * ```
     */
    start({ webhook, longPolling, dropPendingUpdates, allowedUpdates: allowedUpdatesRaw, deleteWebhook: deleteWebhookRaw, }?: BotStartOptions): Promise<TelegramUser>;
    /**
     * Stops receiving events via long-polling or webhook
     * */
    stop(timeout?: number): Promise<void>;
}

/**
 * A type guard predicate that narrows `In` to `Out`.
 * Built-in filters use `any` as `In` so they work with any bot's context type.
 * The actual narrowing happens via intersection in the `.on()` handler type.
 */
type Filter<In = any, Out extends In = In> = (context: In) => context is Out;
type ExtractNarrow<F> = F extends Filter<any, infer N> ? N : never;
/** Maps forward origin type strings to their concrete classes */
type ForwardOriginMapping = {
    user: MessageOriginUser;
    chat: MessageOriginChat;
    channel: MessageOriginChannel;
    hidden_user: MessageOriginHiddenUser;
};
type AnyForwardOrigin = ForwardOriginMapping[keyof ForwardOriginMapping];
interface ForwardOriginFilter {
    /** Matches any forwarded message, narrowing `forwardOrigin` to the full origin union */
    (): Filter<any, {
        forwardOrigin: AnyForwardOrigin;
    }>;
    /**
     * Matches forwarded messages of a specific origin type.
     *
     * @example
     * filters.forwardOrigin("user")      // forwarded from a real user
     * filters.forwardOrigin("channel")   // forwarded from a channel
     */
    <T extends keyof ForwardOriginMapping>(type: T): Filter<any, {
        forwardOrigin: ForwardOriginMapping[T];
    }>;
}
type ChatTypeUnion = "private" | "group" | "supergroup" | "channel";
interface SenderChatFilter {
    /** Matches messages sent on behalf of a chat, narrowing `senderChat` to `Chat` */
    (): Filter<any, {
        senderChat: Chat;
    }>;
    /**
     * Matches messages sent on behalf of a chat of a specific type.
     *
     * @example
     * filters.senderChat("channel")    // anonymous channel post
     * filters.senderChat("supergroup") // anonymous supergroup admin
     */
    <T extends ChatTypeUnion>(type: T): Filter<any, {
        senderChat: Chat & {
            type: T;
        };
    }>;
}
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
/** Union of all attachment types (shorthand for `AttachmentsMapping[keyof AttachmentsMapping]`) */
type AnyAttachment = AttachmentsMapping[keyof AttachmentsMapping];
declare const filters: {
    photo: Filter<any, {
        attachment: _gramio_contexts.PhotoAttachment;
    }>;
    video: Filter<any, {
        attachment: _gramio_contexts.VideoAttachment;
    }>;
    document: Filter<any, {
        attachment: _gramio_contexts.DocumentAttachment;
    }>;
    audio: Filter<any, {
        attachment: _gramio_contexts.AudioAttachment;
    }>;
    sticker: Filter<any, {
        attachment: _gramio_contexts.StickerAttachment;
    }>;
    voice: Filter<any, {
        attachment: _gramio_contexts.VoiceAttachment;
    }>;
    videoNote: Filter<any, {
        attachment: _gramio_contexts.VideoNoteAttachment;
    }>;
    animation: Filter<any, {
        attachment: _gramio_contexts.AnimationAttachment;
    }>;
    contact: Filter<any, {
        attachment: _gramio_contexts.ContactAttachment;
    }>;
    location: Filter<any, {
        attachment: _gramio_contexts.LocationAttachment;
    }>;
    poll: Filter<any, {
        attachment: _gramio_contexts.PollAttachment;
    }>;
    /** Matches any message that has an attachment */
    media: Filter<any, {
        attachment: AnyAttachment;
    }>;
    /** Matches messages that have text */
    text: Filter<any, {
        text: string;
    }>;
    /** Matches messages that have a caption */
    caption: Filter<any, {
        caption: string;
    }>;
    /** Matches messages that contain a dice */
    dice: Filter<any, {
        dice: Dice;
    }>;
    /** Matches forwarded messages. Call without args for any origin, or pass a type to narrow precisely. */
    forwardOrigin: ForwardOriginFilter;
    /** Matches messages that are replies */
    reply: Filter<any, {
        replyMessage: Message;
    }>;
    /** Matches messages that have text entities */
    entities: Filter<any, {
        entities: MessageEntity[];
    }>;
    /** Matches messages that have caption entities */
    captionEntities: Filter<any, {
        captionEntities: MessageEntity[];
    }>;
    /** Matches messages that have a quote */
    quote: Filter<any, {
        quote: TextQuote;
    }>;
    /** Matches messages sent via a bot */
    viaBot: Filter<any, {
        viaBot: User;
    }>;
    /** Matches messages that have link preview options */
    linkPreview: Filter<any, {
        linkPreviewOptions: LinkPreviewOptions;
    }>;
    /** Matches messages with a /start payload */
    startPayload: Filter<any, {
        startPayload: string;
    }>;
    /** Matches messages with a raw /start payload string */
    rawStartPayload: Filter<any, {
        rawStartPayload: string;
    }>;
    /** Matches messages with an author signature */
    authorSignature: Filter<any, {
        authorSignature: string;
    }>;
    /** Matches messages with external reply info */
    replyInfo: Filter<any, {
        externalReply: ExternalReplyInfo;
    }>;
    /** Matches contexts that have a sender (from user) */
    hasFrom: Filter<any, {
        from: User;
        senderId: number;
    }>;
    /** Matches messages sent on behalf of a chat. Pass a type to also narrow `senderChat.type`. */
    senderChat: SenderChatFilter;
    /** Matches giveaway messages */
    giveaway: Filter<any, {
        giveaway: Giveaway;
    }>;
    /** Matches messages with paid media */
    paidMedia: Filter<any, {
        paidMedia: PaidMediaInfo;
    }>;
    /** Matches messages with a game */
    game: Filter<any, {
        game: Game;
    }>;
    /** Matches messages with a story */
    story: Filter<any, {
        story: StoryAttachment;
    }>;
    /** Matches messages with an effect ID */
    effectId: Filter<any, {
        effectId: string;
    }>;
    /** Matches messages that belong to a media group */
    mediaGroup: Filter<any, {
        mediaGroupId: string;
    }>;
    /** Matches messages with a venue */
    venue: Filter<any, {
        venue: Venue;
    }>;
    /** Matches messages from bot accounts */
    isBot: (ctx: any) => boolean;
    /** Matches messages from premium users */
    isPremium: (ctx: any) => boolean;
    /** Matches messages in forum (topic) chats */
    isForum: (ctx: any) => boolean;
    /** Matches service messages */
    service: (ctx: any) => any;
    /** Matches messages in topics */
    topicMessage: (ctx: any) => any;
    /** Matches media with spoiler. Narrows `attachment` to confirm media is present. */
    mediaSpoiler: Filter<any, {
        attachment: AnyAttachment;
    }>;
    /** Matches messages with protected content. No type narrowing. */
    protectedContent: (ctx: any) => boolean;
    /** Matches messages sent while user was offline. No type narrowing. */
    fromOffline: (ctx: any) => boolean;
    /** Matches callback queries that have an associated message */
    hasMessage: Filter<any, {
        message: MessageContext<any>;
    }>;
    /** Matches callback queries that have data */
    hasData: Filter<any, {
        data: string;
    }>;
    /** Matches callback queries with an inline message ID */
    hasInlineMessageId: Filter<any, {
        inlineMessageId: string;
    }>;
    /** Matches callback queries with a game short name */
    hasGameShortName: Filter<any, {
        gameShortName: string;
    }>;
    /** Matches messages with a specific text entity type */
    entity(type: TelegramMessageEntity["type"]): Filter<any, {
        entities: MessageEntity[];
    }>;
    /** Matches messages with a specific caption entity type */
    captionEntity(type: TelegramMessageEntity["type"]): Filter<any, {
        captionEntities: MessageEntity[];
    }>;
    /** Matches messages from a specific chat type. Narrows both `chatType` and `chat.type`. */
    chat<T extends "private" | "group" | "supergroup" | "channel">(type: T): Filter<any, {
        chatType: T;
        chat: {
            type: T;
        };
    }>;
    /** Matches private (DM) chats. Narrows both `chatType` and `chat.type`. */
    pm: Filter<any, {
        chatType: "private";
        chat: {
            type: "private";
        };
    }>;
    /** Matches group chats. Narrows both `chatType` and `chat.type`. */
    group: Filter<any, {
        chatType: "group";
        chat: {
            type: "group";
        };
    }>;
    /** Matches supergroup chats. Narrows both `chatType` and `chat.type`. */
    supergroup: Filter<any, {
        chatType: "supergroup";
        chat: {
            type: "supergroup";
        };
    }>;
    /** Matches channel chats. Narrows both `chatType` and `chat.type`. */
    channel: Filter<any, {
        chatType: "channel";
        chat: {
            type: "channel";
        };
    }>;
    /** Matches messages from specific user(s). No type narrowing. */
    from(userId: number | number[]): (ctx: any) => boolean;
    /** Matches messages in specific chat(s). No type narrowing. */
    chatId(chatId: number | number[]): (ctx: any) => boolean;
    /** Matches messages whose text/caption matches the regex, sets `ctx.match` */
    regex(pattern: RegExp): Filter<any, {
        match: RegExpMatchArray;
    }>;
    /** Intersection: both filters must match */
    and<N1, N2>(f1: Filter<any, N1>, f2: Filter<any, N2>): Filter<any, N1 & N2>;
    /** Union: either filter must match */
    or<N1, N2>(f1: Filter<any, N1>, f2: Filter<any, N2>): Filter<any, N1 | N2>;
    /** Negation: inverts the filter (no type narrowing) */
    not(f: (ctx: any) => boolean): (ctx: any) => boolean;
    /** Variadic intersection: all filters must match */
    every<Filters extends Filter<any, any>[]>(...filters: Filters): Filter<any, UnionToIntersection<ExtractNarrow<Filters[number]>>>;
    /** Variadic union: any filter must match */
    some<Filters extends Filter<any, any>[]>(...filters: Filters): Filter<any, ExtractNarrow<Filters[number]>>;
};

declare const frameworks: {
    elysia: ({ body, headers }: any) => {
        update: any;
        header: any;
        unauthorized: () => Response;
        response: () => Response;
    };
    fastify: (request: any, reply: any) => {
        update: any;
        header: any;
        unauthorized: () => any;
        response: () => any;
    };
    hono: (c: any) => {
        update: any;
        header: any;
        unauthorized: () => any;
        response: () => Response;
    };
    express: (req: any, res: any) => {
        update: any;
        header: any;
        unauthorized: () => any;
        response: () => any;
    };
    koa: (ctx: any) => {
        update: any;
        header: any;
        unauthorized: () => void;
        response: () => void;
    };
    http: (req: any, res: any) => {
        update: Promise<TelegramUpdate>;
        header: any;
        unauthorized: () => any;
        response: () => any;
    };
    "std/http": (req: any) => {
        update: any;
        header: any;
        response: () => Response;
        unauthorized: () => Response;
    };
    "Bun.serve": (req: any) => {
        update: any;
        header: any;
        response: () => Response;
        unauthorized: () => Response;
    };
    cloudflare: (req: any) => {
        update: any;
        header: any;
        response: () => Response;
        unauthorized: () => Response;
    };
    Request: (req: any) => {
        update: any;
        header: any;
        response: () => Response;
        unauthorized: () => Response;
    };
};

/** Union type of webhook handlers name */
type WebhookHandlers = keyof typeof frameworks;
interface WebhookHandlerOptionsShouldWait {
    /** Action to take when timeout occurs. @default "throw" */
    onTimeout?: "throw" | "return";
    /** Timeout in milliseconds. @default 10_000 */
    timeout?: number;
}
interface WebhookHandlerOptions {
    secretToken?: string;
    shouldWait?: boolean | WebhookHandlerOptionsShouldWait;
}
/**
 * Setup handler with yours web-framework to receive updates via webhook
 *
 *	@example
 * ```ts
 * import { Bot } from "gramio";
 * import Fastify from "fastify";
 *
 * const bot = new Bot(process.env.TOKEN as string).on(
 * 	"message",
 * 	(context) => {
 * 		return context.send("Fastify!");
 * 	},
 * );
 *
 * const fastify = Fastify();
 *
 * fastify.post("/telegram-webhook", webhookHandler(bot, "fastify"));
 *
 * fastify.listen({ port: 3445, host: "::" });
 *
 * bot.start({
 *     webhook: {
 *         url: "https://example.com:3445/telegram-webhook",
 *     },
 * });
 * ```
 */
declare function webhookHandler<Framework extends keyof typeof frameworks>(bot: AnyBot, framework: Framework, secretTokenOrOptions?: string | WebhookHandlerOptions): ReturnType<(typeof frameworks)[Framework]> extends {
    response: () => any;
} ? (...args: Parameters<(typeof frameworks)[Framework]>) => ReturnType<ReturnType<(typeof frameworks)[Framework]>["response"]> : (...args: Parameters<(typeof frameworks)[Framework]>) => void;

export { AllowedUpdatesFilter, Bot, Composer, ErrorKind, Hooks, OPT_IN_TYPES, Plugin, TelegramError, Updates, methods as _composerMethods, buildAllowedUpdates, detectOptInUpdates, filters, mapEventToAllowedUpdates, webhookHandler };
export type { AllowedUpdateName, AllowedUpdates, AnyBot, AnyPlugin, BotOptions, BotStartOptions, BotStartOptionsLongPolling, BotStartOptionsWebhook, CallbackQueryShorthandContext, CommandMeta, DeriveDefinitions, ErrorDefinitions, Filter, Handler, MaybePromise, MaybeSuppressedParams, MaybeSuppressedReturn, PollingStartOptions, ScopeShorthand, Suppress, SuppressedAPIMethodParams, SuppressedAPIMethodReturn, SuppressedAPIMethods, SyncCommandsOptions, SyncStorage, WebhookHandlerOptions, WebhookHandlerOptionsShouldWait, WebhookHandlers };
