<commit_before>import telebot
import logging
import time
import threading
import argparse
# from datetime import date, time, datetime, timedelta

import libremu_backend as engine

logging.basicConfig(filename='log.txt', format='[%(asctime)s] [%(levelname)s]  %(message)s', level=logging.INFO)

f = open('token.id', 'r')
token = f.read()
f.close()
bot = telebot.TeleBot(token)
chat_id = 0

# @bot.message_handler(content_types=['document', 'audio'])
# def handle_docs_audio(message):
#     file_info = bot.get_file(message.document.file_id)
#     file = bot.download_file(file_info.file_path)
#     with open(message.document.file_name, 'wb') as f:
#         f.write(file)

@bot.message_handler(commands=['list', 'help'])
def handle_list(message):
    l = engine.get_active_events()
    text = '\n'.join(l)
    bot.send_message(chat_id, text)

@bot.message_handler(content_types=["text"])
def send_to_engine(message):
    global chat_id
    if chat_id != message.chat.id:
        chat_id = message.chat.id
        save_chat_id()
    handle_user_message(message.text)


@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
    if call.message:
        if call.data != "Ok":
            handle_user_message(call.data + " " + call.message.text)
        # delete keys
        bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=call.message.text)


def handle_user_message(message_text):
    text = engine.handle_text_message(message_text)
    bot.send_message(chat_id, text)


def send_message(message_text):
    keyboard = telebot.types.InlineKeyboardMarkup()<commit_msg>List command. Add reply when list is empty<commit_after>import telebot
import logging
import time
import threading
import argparse
# from datetime import date, time, datetime, timedelta

import libremu_backend as engine

logging.basicConfig(filename='log.txt', format='[%(asctime)s] [%(levelname)s]  %(message)s', level=logging.INFO)

f = open('token.id', 'r')
token = f.read()
f.close()
bot = telebot.TeleBot(token)
chat_id = 0

# @bot.message_handler(content_types=['document', 'audio'])
# def handle_docs_audio(message):
#     file_info = bot.get_file(message.document.file_id)
#     file = bot.download_file(file_info.file_path)
#     with open(message.document.file_name, 'wb') as f:
#         f.write(file)

@bot.message_handler(commands=['list', 'help'])
def handle_list(message):
    l = engine.get_active_events()
    text = '\n'.join(l) if l else 'No current active event'
    bot.send_message(chat_id, text)

@bot.message_handler(content_types=["text"])
def send_to_engine(message):
    global chat_id
    if chat_id != message.chat.id:
        chat_id = message.chat.id
        save_chat_id()
    handle_user_message(message.text)


@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
    if call.message:
        if call.data != "Ok":
            handle_user_message(call.data + " " + call.message.text)
        # delete keys
        bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=call.message.text)


def handle_user_message(message_text):
    text = engine.handle_text_message(message_text)
    bot.send_message(chat_id, text)


def send_message(message_text):
    keyboard = telebot.types.InlineKeyboardMarkup()
{'fraction_non_alphanumeric': 0.12923538230884557, 'fraction_numerical': 0.0005997001499250374, 'mean_word_length': 4.541528239202658, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1279872', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1121, 'n_words': 211}