示例#1
0
文件: main_file.py 项目: Svetkina/tel
def covid_handler(update: Update, context: CallbackContext, tool):
    value = ''
    if tool == button_covid_world:
        covid = Covid19()
        value = covid.check_in_the_world()
    if tool == button_covid_russia:
        covid = Covid19()
        value = covid.check_in_the_russia()
    if tool == button_covid_usa:
        covid = Covid19()
        value = covid.check_in_the_usa()
    if tool == button_covid_dif:
        value = covid_info
    if tool[0] == '?':
        covid = Covid19()
        value = covid.covid_in_different_country(tool)
    if value == 1:
        value = "Врачи пока не могут поделиться информацией.."
    update.message.reply_text(text=value, )
示例#2
0
def covid_in_the_world(event):
    covid19 = Covid19()
    vk = vk_session.get_api()
    vk.messages.send(user_id=event.obj.message['from_id'], message=random.choice(waiting),
                     random_id=random.randint(0, 2 ** 64))
    try:
        value = covid19.check_in_the_world()
        vk.messages.send(user_id=event.obj.message['from_id'], message=value,
                         random_id=random.randint(0, 2 ** 64))
    except Exception as ex:
        value = "Врачи пока не могут дать статистику"
        vk.messages.send(user_id=event.obj.message['from_id'], message=value,
                         random_id=random.randint(0, 2 ** 64))
    return