コード例 #1
0
def show_graph(message):
    try:
        countryname = check_country(message)
        plot = plotting.history_graph(countryname)
        BOT.send_photo(message.chat.id, plot)
    except:
        BOT.send_message(message.chat.id, "An error occured. Try again")
コード例 #2
0
def send_graph(message):
    LOGGER.info(f"{message.chat.id}-{message.chat.username}-command:{message.text}")
    language = language_check(message.chat.id)
    country_arg = extract_arg(message.text)
    update_user_checktime(message.chat.id)
    try:
        if country_arg:
            countryname = check_country(message, country_arg[0])
            plot = plotting.history_graph(countryname)
            BOT.send_photo(message.chat.id, plot)
            plot.close()
        else:
            BOT.send_message(message.chat.id, config.TRANSLATIONS[language]["country-type"])
            BOT.register_next_step_handler(message, show_graph)
    except:
        BOT.send_message(message.chat.id, "An error occured. Try again")
コード例 #3
0
def show_graph_query(countryname):
    if countryname == 'all':
        plot = plotting.history_graph('all')
    else:
        plot = plotting.history_graph(countryname)
    return plot