Botocrat is a minimal and flexible Telegram bot framework that provides context oriented programming API along with express-like middlewares.
Botocrat has following packages you can use or replace with your own.
| Package | |
|---|---|
| @botocrat/telegram | Telegram Bot Client |
| @botocrat/poller | Polls Telegram server to .getUpdates() |
| @botocrat/express | Express middleware to receive updates from webhook |
| @botocrat/state | Persistent/volatile state (stored in redis) management middleware (coming soon) |
- Context Oriented Approach
- Flexible ( You can create & share middlewares )
- Lightest & low-overhead
- Typescript Support
- Consecutive sending, chaining and waiting
npm exec botocrat my-telegram-botnpm i @botocrat/core @botocrat/telegram @botocrat/poller --saveimportBotocratfrom'@botocrat/core'importcreateClientfrom'@botocrat/telegram'importpollerfrom'@botocrat/poller'constclient=createClient({token: TELEGRAM_BOT_TOKEN})constbot=newBotocrat().get('message',(req,res)=>{res.send(`Hello ${req.from.first_name}!`)// .sent.wait(1000).reply('Thank you for choosing us')})poller(bot,client).poll()Read the detailed documentation on GitHub Wiki
You can ask questions on GitHub
MIT License
