UNPKG

@botol/tg-bot

Version:

## Simple Examples ```typescript import { BotolTg } from '@botol/tg-bot';

24 lines (23 loc) 904 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BotolTg = void 0; const tg_client_1 = require("@botol/tg-client"); const tg_dipo_1 = require("@botol/tg-dipo"); class BotolTg { constructor(token, params) { this.token = token; this.params = params; this.middleware = (handler) => this.dipo.middleware(handler); this.on = (event, handler) => this.dipo.on(event, handler); this.use = (handler) => this.dipo.use(handler); this.handle = (context) => this.dipo.handle(context); this.dipo = new tg_dipo_1.DipoTG(tg_dipo_1.DefaultEvents); this.client = new tg_client_1.TgClient(token, (update) => { return this.dipo.handle(new tg_dipo_1.ContextTG(update, this.client)); }); } startPolling() { this.client.start(); } } exports.BotolTg = BotolTg;