Ejemplo n.º 1
0
        elif len(result) != 0:
            bot.send_message(
                message.chat.id, "Теги удалены. Обновленный список тегов:\n" +
                "\n".join(result))
        else:
            bot.send_message(message.chat.id, "Тегов нет")


@bot.message_handler(commands=["del_all_tags"])
def delete_all_tags(message):
    result = dbAdapter.del_all_tags(message.chat.id)
    if result is None:
        bot.send_message(message.chat.id, config.ERROR_MESSAGE)
    else:
        bot.send_message(message.chat.id, "Список тегов пуст")


send_articles_thread = Thread(target=send_articles)
send_articles_thread.start()

# Start bot
while True:
    try:
        logAdapter.event("Launch bot")
        bot.threaded = False
        bot.skip_pending = True
        bot.polling()
    except Exception as e:
        logAdapter.error(str(e))
        bot.stop_polling()