import COVID19Py
import telebot
covid19 = COVID19Py.COVID19()
bot = telebot.TeleBot('1104793417:AAFwpiKk-p8AFGjZLPOlYeDymstulIrhXPw')
base_url="
https://telegg.ru/orig/bot",
@bot.message_handler(commands=['start'])
def start(message):
send_mess = f"
Привет! {message.from_user.first_name}\nВведи страну!"
bot.send_message(message.chat.id, send_mess, parse_mode='html')
@bot.message_handler(content_types=['text'])
def mess(message):
final_message = ""
get_message_bot = message.text.strip().lower()
if get_message_bot == "сша":
location = covid19.getLocationByCountryCode("US")
elif get_message_bot == "украина":
location = covid19.getLocationByCountryCode("UA")
elif get_message_bot == "россия":
location = covid19.getLocationByCountryCode("RU")
else:
location = covid19.getLatest()
final_message = f"Данные по всему миру:\n
Заболевшие: {location['confirmed']}\n"
if final_message =="":
date = location[0]['last_updated'].split("T")
time = date[1].split(".")
final_message = f"Данные по всему миру:\n
Заболевшие: {location['confirmed']}\n"
bot.send_message(message.chat.id, final_message, parse_mode='html')
latest = covid19.getLatest()
location = covid19.getLocationByCountryCode("US")
print(latest)