@glideco/telegram-bot-router
v0.1.0
Published
Dep-free Telegram Bot API client + slash-command dispatcher with LLM-fallback hook. No telegraf/grammy dep — webhook-mode, fetch-based, MarkdownV2 escape helpers.
Downloads
24
Maintainers
Readme
@glideco/telegram-bot-router
Dep-free Telegram Bot API client + slash-command dispatcher.
No telegraf / grammy / node-telegram-bot-api dependency. Webhook-mode
only (no polling), fetch-based, MarkdownV2 escape helpers built-in.
Usage
import {
createTelegramApi,
createDispatcher,
type CommandHandler,
} from '@glideco/telegram-bot-router';
const api = createTelegramApi({ botToken: process.env.TELEGRAM_BOT_TOKEN! });
const balanceCmd: CommandHandler<MyCtx> = {
command: 'balance',
aliases: 'balance,bal',
description: 'Show your balance',
async run(ctx) {
await api.sendMessage(ctx.chatId, `Balance: $${ctx.balance}`);
},
};
const dispatcher = createDispatcher<MyCtx>({
api,
commands: [balanceCmd /* ... */],
fallback: async (ctx) => {
// optional: invoke an LLM agent for freeform messages
},
});
// In your webhook route:
await dispatcher.dispatch(myContext);License
MIT
