Golang Telegram Bot Framework
Telegram Bots:
“ Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands and inline requests. You control your bots using HTTPS requests to our bot API.”
I have decided to open source Gotelbot, a framework I’ve developed and have been using for a year now to make telegram bots.
Gotelbot uses MongoDB as default data storage currently. But it will expand to more database management systems like MySQL.
Along with Gotelbot you can use Gomondel to generate MongoDB models in your project like a piece of cake. Gotelbot uses it to create default users model for the bot to store users information.
Features:
- Multilingual: if you’re developing a bot for users speaking several languages, you can pass
--langs=english,persian,etc
to gotelbot, it will create language files, it also makes a menu where users can choose their language. - Menu Based: having a menu field in users collection saves any user’s state, this way your bot knows what is next to do. There’s a method called
SwitchMenu(menuName string)
, that checks if there’s a method namedmenuName
in your application and calls it. - More to come: currently you can add menus to your bot using command
gotelbot --menu=menuName
, this will add a method calledmenuName
and its related texts to language files. You will be able to add Inline Menus and callback handlers with simple commands soon.
If you know how to make gotelbot better, don’t forget to create a new issue on Gotelbot’s github page.
Thanks for reading.