This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
covid-19-discord-bot/lib/covidData.py

36 lines
No EOL
1.3 KiB
Python
Executable file

class covidData():
def __init__(self, selection='', import_data=[]):
super().__init__()
if(selection and len(import_data) > 8):
self.set_data(selection, import_data)
else:
self.data = {
'Selection': '',
'Total Cases': '',
'New Cases': '',
'Total Deaths': '',
'New Deaths': '',
'Total Recovered': '',
'Active Cases': '',
'Serious/Critical': '',
'Total Cases/1M Population': ''
}
def set_data(self, selection, import_data):
self.data = {
'Selection': selection,
'Total Cases': import_data[1].strip(),
'New Cases': import_data[2].strip(),
'Total Deaths': import_data[3].strip(),
'New Deaths': import_data[4].strip(),
'Total Recovered': import_data[5].strip(),
'Active Cases': import_data[6].strip(),
'Serious/Critical': import_data[7].strip(),
'Total Cases/1M Population': import_data[8].strip()
}
def get_formatted_data(self):
output = ''
for key in self.data.keys():
output += f'{key}: {self.data[key]}\n'
return output