@apidog/multibot-sdk-ts
Version: 
Telegram and VK bot SDK for TypeScript
20 lines (19 loc) • 676 B
TypeScript
import { IMatcher } from './utils';
export interface IBotPolling {
    startPolling(): void;
    stopPolling(): void;
}
export interface IBotWebHook {
    startServer(port: number): void;
    stopServer(): void;
}
export interface IBot {
    request<T>(method: string, params?: Record<string, unknown>): Promise<T>;
}
export default abstract class AbstractBot<Config, Update> implements IBot {
    protected config: Config;
    protected matcher: IMatcher<Update>;
    protected setMatcher(matcher: IMatcher<Update>): this;
    protected abstract getApiEndpoint(method: string): string;
    abstract request<T>(method: string, params?: Record<string, unknown>): Promise<T>;
}