/** * MTKruto - Cross-runtime JavaScript library for building Telegram clients * Copyright (C) 2023-2026 Roj * * This file is part of MTKruto. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import type { MaybePromise } from "../1_utilities.js"; import type { ChatP, Update } from "../3_types.js"; import type { NextFunction } from "./0_utilities.js"; import type { ClientGeneric } from "./1_client_generic.js"; import type { FilterQuery, WithChatType, WithFilter } from "./3_filters.js"; import { Context, type ContextCommands } from "./4_context.js"; export type MiddlewareFn = (ctx: C, next: NextFunction) => MaybePromise; export interface MiddlewareObj { middleware: () => MiddlewareFn; } export type Middleware = MiddlewareFn | MiddlewareObj; export declare function flatten(mw: Middleware): MiddlewareFn; export declare function concat(left: MiddlewareFn, right: MiddlewareFn): MiddlewareFn; export declare function skip(_ctx: C, next: NextFunction): Promise; export declare class Composer implements MiddlewareObj { #private; set prefixes(value: string | string[]); constructor(...middleware: Middleware[]); handleUpdate(client: ClientGeneric, update: Update): Promise; middleware(): MiddlewareFn; use(...middleware: Middleware[]): Composer; branch(predicate: (ctx: C) => MaybePromise, trueHandler_: Middleware, falseHandler_: Middleware): Composer; filter(predicate: (ctx: C) => ctx is D, ...middleware: Middleware[]): Composer; filter(predicate: (ctx: C) => MaybePromise, ...middleware: Middleware[]): Composer; on(filter: Q, ...middleware: Middleware>[]): Composer>; command(commands: ContextCommands, ...middleware: Middleware>[]): Composer>; callbackQuery(data: string | RegExp | (string | RegExp)[], ...middleware: Middleware>[]): Composer>; inlineQuery(queries: string | RegExp | (string | RegExp)[], ...middleware: Middleware>[]): Composer>; chosenInlineResult(queries: string | RegExp | (string | RegExp)[], ...middleware: Middleware>[]): Composer>; chatType(chatType: T | T[], ...middleware: Middleware>[]): Composer>; } //# sourceMappingURL=5_composer.d.ts.map