A Telegram bot that gives latest updates about confirmed COVID-19 cases in India, pulling the information from the website of the Indian Ministry of Health and Family Welfare (https://www.mohfw.gov.in/)
- Create directory:
mkdir corona_bot && cd corona_bot
- Clone the repo:
git clone github.com/ankan17/corona_bot.git src
- Create a virtual environment:
python3 -m venv .
- Activate virtual environment:
source bin/activate
- Install dependencies:
pip3 install -r requirements.txt
- Use the instructions here to generate the bot token and get the group id: https://dev.to/mddanishyusuf/build-telegram-bot-to-send-daily-notification-4i00
- Copy the .env.example file and update the bot token and the group id:
cp src/.env.example src/.env
and update the .env file - Check if scraper.py is working properly:
python3 scraper.py
(You should see a message) - Schedule the job using crontab (this schedules the job to run every 10 minutes)
env EDITOR=nano crontab -e
*/10 * * * * cd path/to/corona_bot && source bin/activate && python3 src/scraper.py >/tmp/stdout.log 2>/tmp/stderr.log
- Done!
Source of information: https://www.mohfw.gov.in/