from covid import Covid
import telebot
import config
bot = telebot.TeleBot(config.TOKEN)
covid = Covid()
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.reply_to(message, "Начнем")
@bot.message_handler(content_types=['text'])
def start(message):
final_message = ""
get_message_bot = message.text.strip().lower()
if get_message_bot == "США":
location = covid.get_status_by_country_name("us")
elif get_message_bot == "Украина":
location = covid.get_status_by_country_name("Ukraine")
elif get_message_bot == "Россия":
location = covid.get_status_by_country_name("russia")
elif get_message_bot == "Беларусь":
location = covid.get_status_by_country_name("Belarus")
elif get_message_bot == "Казахстан":
location = covid.get_status_by_country_name("Kazakhstan")
elif get_message_bot == "Италия":
location = covid.get_status_by_country_name("italy")
elif get_message_bot == "Франция":
location = covid.get_status_by_country_name("france")
elif get_message_bot == "Германия":
location = covid.get_status_by_country_name("Germany")
elif get_message_bot == "Япония":
location = covid.get_status_by_country_name("Japan")
final_message = f"<u>Данные по стране:</u>\n<b>Заболевших: </b>{location['confirmed']:,}\n<b>Умерших: </b>{location['deaths']:,}\n<b>Выздоровевших: </b>{location['recovered']:,}\n<b>Болеющих: </b>{location['active']:,}"
else:
location = covid.get_status_by_country_name("russia")
bot.send_message(message.chat.id, final_message, parse_mode='html')
bot.polling(none_stop=True)