@wasserstoff/mangi-tg-bot
Version:
A powerful Telegram Bot SDK with built-in authentication, session management, and database integration
45 lines • 2.15 kB
TypeScript
import { Bot } from "grammy";
import { AppConfig } from "..";
import { CustomContext } from "./context/CustomContext";
import type { FilterQuery } from "grammy";
export declare class BotManager {
private bot;
private config;
private composer;
private registeredCommands;
private sdkLogger;
private messageHandlers;
private callbackHandlers;
private messageHandlersWithAuth;
private callbackHandlersWithAuth;
constructor(botToken: string, redisInstance: any, config: AppConfig);
handleCommand(command: string, handler: (ctx: CustomContext) => Promise<void>, message?: string, buttons?: Array<Array<{
text: string;
callback_data: string;
}>>): void;
setMyCommands(commands: Array<{
command: string;
description: string;
}>): Promise<void>;
handleCallback(filter: (ctx: CustomContext) => boolean, handler: (ctx: CustomContext) => Promise<void>): void;
handleMessage(filter: (ctx: CustomContext) => boolean, handler: (ctx: CustomContext) => Promise<void>): void;
start(): Promise<void>;
stop(): Promise<void>;
getBot(): Bot<CustomContext>;
handleCommandWithAuth(command: string, handler: (ctx: CustomContext) => Promise<void>, message?: string, buttons?: Array<Array<{
text: string;
callback_data: string;
}>>): void;
handleCallbackWithAuth(filter: (ctx: CustomContext) => boolean, handler: (ctx: CustomContext) => Promise<void>): void;
handleMessageWithAuth(filter: (ctx: CustomContext) => boolean, handler: (ctx: CustomContext) => Promise<void>): void;
/**
* Register a handler for any event type (e.g., 'chat_member', 'my_chat_member', etc.)
* This is the recommended way to add group or channel event listeners.
*
* @param event - grammY filter query string (e.g. 'message', 'chat_member', 'message:text', etc.)
* Type-safe and autocompleted in editors.
* @param handler - async function to handle the event
*/
handleEvent(event: FilterQuery | FilterQuery[], handler: (ctx: CustomContext) => Promise<void>): void;
}
//# sourceMappingURL=BotManager.d.ts.map