telegram-bot-maker
A nodejs lightweight library wrapper to telegram bot api
Learn More about telegram bots
if you want learn more about Telegram bots
How did it come about?
After try make may own bot with currents nodejs libraries ( Telegraf and others) and face some issues like:
- Uncaught exception
- Bugs, memory leaks
- About weeks to accept pull request with bugfix
- Very verbose to work listening to answers and creating buttons / menus
That module arose from my need to create a bot, so I needed to quickly develop a module that would meet my needs, so I didn't bother to implement all the methods / features available in the telegram API.
My only concern was to develop code that didn't break the application.
If you want to help implement new features or improve code quality, your help is most welcome! 😊
Requirements
- Nodejs V8 +
Limitations
It's only for long polling bot, Webhook will be implemented soon. Feel free to help us!
Install
$ npm install telegram-bot-maker
Usage
const Bot = const bot = token: 'YOUR-BOT-TOKEN' updateInterval: 500 // interval that bot will looking for updates bot
Bot Methods
Start the bot
bot
Stop the bot
bot
Add listener to command
// * Is Required //<String> command * //<Function> handler * bot //exemple bot
Add listener to bot
// * Is Required //<String> listener * 'message' || 'update' //<Function> handler * bot //exemple bot
Wait For User reply
ctx.waitForReply(handler)
bot
Creating Menu
ctx.replyWithMenu(MenuSettings)
bot
Submenu
bot
Custom Inline Buttons
bot
Custom Buttons
bot
send Photos to user
To send photos to user you must pass url or filePath param.
ctx
Availables Api Methods
- getMe
- sendMessage
- forwardMessage
- sendPhoto
- sendAudio
- sendDocument
- sendVideo
- sendAnimation
- sendVoice
- sendVideoNote
- sendMediaGroup
- sendLocation
- editMessageLiveLocation
- stopMessageLiveLocation
- sendVenue
- sendContact
- sendPoll
- sendChatAction
- getUserProfilePhotos
- editMessageText
Notes
All updates that remain when the bot is off will be bypassed, it will only react to updates that happen while it is alive, I choose for this architecture to prevent anomalous behavior.
This module is in its infancy and still relies on possible help to make it more robust.