Telegram bot which fetches Bot posts top submissions from a subreddit. NewsBot is used to demo a short, simple Python project in my book, Practical Docker With Python.
Refer to the book repo for other exercises using this code.
-
Clone the repo or download the code
-
Install the requirements with pip
pip3 install -r requirements.txt
-
Set the environment variable
NBT_ACCESS_TOKENwhere the value is the Bot token generated using Telegram BotFather.- See instructions on how to generate the token in Chapter 3 or refer to this guide
- See this guide on how to set environment variables
-
Start the bot python newsbot.py
where <token> is the Telegram Bot API token