Meet lulzbot, a Telegram bot built using Telegram Bot API
25 July 2015 By Bhavyanshu Parasher
Add it to your telegram group and have fun @lulzbot
I spent this weekend coding a bot for Telegram messaging app. The bot is similar to what I used to have for my IRC channels as well. It’s just that integrating all the social plugins was a new thing. Thanks to the wrappers available for social APIs, they sure made it easier.
It is free to use and you can actually grab the source code of it from github. The license is GPL so you are free to do whatever you want to do with it.
|Displays list of Commands
|Google search by keyword
|Lookup for wikipedia article
|Get recent activity of user
|/translate from to “strng”
|/translate en hi “I’m good”
|Get posts of instagram user
|Get random Instagram post and start HotOrNot
|/hon or /hotornot
|Get tweets of twitter user
|/yt keyword string
|Search youtube for video
|/yt Iron Maiden
|Get a random cat pic
|Get weather update for city
|Get gif from giphy
|Calculate math expressions
Note that some features of the actual bot @lulzbot registered on telegram will be missing from here. Like bot administration commands and commands meant for my own personal use. However, they do not break this code nor do they in any way affect the working on this code. They are completely unrelated modules. On request, I can explain how you can write bot administration commands for Telegram bot API.
Derive your own bot from this
- First open data/config.ini file and add all the required API keys from various social media sites. For telegram token, contact @BotFather on telegram and create a new bot there. @BotFather will reply provide you the token once the bot is created.
Then you need to make sure you have all the required dependencies. Python 2.7 is required. Apart from that I have provided requirements.txt file and pip command should be able to fetch it all for you.
$ pip install -r requirements.txt
- For debugging, run using
python bot.py. If there is a crash, it won’t restart. Test all the commands.
- For production mode, run
./botmon.shwhich will restart bot if it crashes.
- Now you can make any changes you want and use it as your own bot in telegram.
Copyright (C) 2015 Bhavyanshu Parasher
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Create an issue if you find any bug. If you want to improve something, send a pull request.
blog comments powered by Disqus