Skip to content

mik3sw/covid19bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

covid19bot

Link: covid19italtreportbot

[it] Bot Telegram che fornisce dettagliati aggiornamenti giornalieri riguardo la situazione covid-19 in Italia (contagi, morti, guariti, ...)

[en] This Telegram bot provides daily and detailed updates about covid-19 situation in Italy

Table of Contents

Features and Commands

  • /start: It return a generic start message (every distinguished bot has one! 🧐)
  • /help: It return the help message with all available commands (and which permission is required for each)
  • /day: It return the covid19 report with the lastest data provided by Italian Government
  • /vax: It return the vaccines report with the lastest data provided by Italian Government

How to Run

QuickStart guide to run the bot. DISCLAIMER: I tested this bot only on macOS and Linux

  1. Install dependencies
    • pip install python-telegram-bot
    • pip install requests
    • pip install db-sqlite3
    • pip install psutil
  2. Create database by running tests/sql_script_create.py and move the new created Groups.db into bot folder;
  3. Edit bot/config.py with your settings;
  4. (Optional) Customize commands output by editing strings.ini;
  5. Run the bot with python3 bot.py
  6. NOTE: Windows does not support emoticon and (ò, à, è) characters in strings.ini (I used macOS), you have to rewrite it!

Code Structure

Here a **quick expanation** of what i've done 🚀. I think the code is quite neat, understandable and not redundant, except for covid and vaccines function/classes. It can be better
  • commands
    • admin-only commands
    • user commands
  • dialogs
    • welcome function when bot is added to groups
  • errors
    • console log messages
    • error messages sent to admins
  • function
    • database and messages generic functions
  • plugins
    • covid19 data processing
    • vaccines data processing
  • utils
    • check permissions of commands

Full code tree here!

Scripts

HELP! My scrips work, but they are not so good and fast, if you want you can to contribute to make them better and faster!

Covid19 script

(2020) The daily report function is controlled by plogins/covid19_script.py. I created a Class that through requests gets data from Protezione Civile and with plogins/covid19.py compose the message (/day) I also created a separated package here https://github.com/mik3sw/Covid-19-Italy, you can import it in your python code.

Vaccines script

(2021) I also created a daily report about vaccines in Italy: this function is controlled by plogins/vaccines_script.py. I created a Class that through requests gets data from Protezione Civile and with plogins/vaccines.py compose the message (/vax)