import { Evogram } from '../Client'; import { TelegramUpdate } from '../types'; /** * Represents the context for middleware functions. * Inherits properties from TelegramUpdate and adds the client and any other properties. */ export interface MiddlewareContext extends TelegramUpdate { client: Evogram; state: Record; } /** * Type definition for middleware functions. * It takes a MiddlewareContext and a next function to call the next middleware in the stack. */ export type MiddlewareFunction = (ctx: MiddlewareContext, next: () => Promise) => Promise; /** * Manages the registration and execution of middleware functions for the Evogram client. */ export declare class Middleware { constructor(); static middlewares: MiddlewareFunction[]; private middlewares; /** * Registers a middleware function to the stack. * @param middleware The middleware function to register. */ use(middleware: MiddlewareFunction): void; /** * Executes all registered middleware functions in order. * @param context The context to pass to middleware (includes TelegramUpdate and client). * @returns The context if all middleware executed successfully, or null if not. */ execute(context: MiddlewareContext): Promise; }