Bot for Telegram written in Python 3.4. Uses the wikipedia
and wikiquote
modules.
Telegram now has an official bot API, which this project does not use.
Get the code:
$ git clone --recursive [email protected]:federicotdn/python-tgbot.git
Place the telegram-cli
binary and your Telegram secret key (telegram.key
text file) on the project's bin
directory. Start/stop the bot using the tgbot-ctl
script:
$ chmod +x tgbot-ctl # make sure you can run the script
$ ./tgbot-ctl startbg # start the bot and detach it from the current terminal, 'start' will start the bot normally
$ ./tgbot-ctl stop # stop the bot
The bot is configured using the bot.config
file.
Make sure to run bin/telegram-cli -k bin/telegram.key
at least once before starting the bot, as you will need to setup your phone number first.
TODO: Finish writing instructions.
flip_cmd.py
: returns 'heads' or 'tails' at random.hello_cmd.py
: returns 'hello'.image_cmd.py
: searches Google images, and uploads the first image found. Requires two configuration variables to be set. Get them at the Google Custom Search site and at the Google Developers Console.rand_line_cmd.py
: return a line from a text file at random. The seed file/s need to be specified in the config file.status_cmd.py
: print status information.wikipedia_cmd.py
: returns a summary of the specified Wikipedia article. Requires thewikipedia
Python module (install it usingpip
).quote_cmd.py
: returns a quote from the specified Wikiquote article. Requires thewikiquote
Python module (included as git submodule).wolfram_cmd.py
: returns results from WolframAlpha. Requires a WolframAlphaappid
to be specified in the config file.
To disable a command, delete the corresponding _cmd.py
file.