Amazing-Python-Scripts

Форк
0

README.md

WhatsApp COVID-19 Bot

A COVID-19 Bot build using Twilio API, that tracks the Number of Infected persons, Recovered Persons and Number of Total deaths along with the day-to-day increase in the statistics. The information is then updated via WhatsApp.

Note

The script requires personal info, like API-Token, API-ID, and PHONE-NUMBER for that reason, a .env file has been used, for more info, see usage.

Usage

  • Setup a Virtual Environment.

  • Download dependencies using pip install -r requirements.txt.

  • Set up an account at Twilio. It's Free.

  • Follow this guide for Setting up WhatsApp API.

  • Make a .env file similar to .env.example file.

  • Paste the required information:

    SID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" <ACCOUNT SID goes here>
    TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" <AUTH TOKEN>
    NUM="+91XXXXXXXXXX" <TARGET PHONE NUMBER GOES HERE>
  • The bot script is now ready.

  • For scheduling, apscheduler has been used for cron-style scheduling.

  • The script is coded to run the bot once every day.

  • For making your own cron schedule, use this website.

  • After setting up the Cron Job, run the scheduler script using python3 schedule.py.

Output

Sample Message

Last Updated on: 2021-02-27
Top 3 Indian States sorted by Newly registered cases of COVID-19.
[Maharashtra]
| Total Infected = 68810
| New Infections = 3349
| Total Recovery = 2017303
| New Recovery = 4936
| Total Deaths = 52041
| New Deaths = 48
[Punjab]
| Total Infected = 4222
| New Infections = 352
| Total Recovery = 170968
| New Recovery = 255
| Total Deaths = 5814
| New Deaths = 15
[Gujarat]
| Total Infected = 2136
| New Infections = 145
| Total Recovery = 262487
| New Recovery = 315
| Total Deaths = 4408
| New Deaths = 0

Author(s)

Made by Vybhav Chaturvedi

Disclaimer

Kindly follow all the guidelines of Twilio and respect the request rate.

Despite the recent downfall in cases, COVID-19 is still a major threat for all of us, I strongly request you to follow all the necessary guidelines.

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.