<commit_before>require 'telegram/bot'
require './lib/bot/it_ebook.rb'

token = YAML::load(IO.read('config/secrets.yml'))['telegram_token']

Telegram::Bot::Client.run(token) do |bot|
  bot.listen do |message|
    case message
    when Telegram::Bot::Types::CallbackQuery
      begin
        query = message.data.split('/')[0]
        page_to_look_for = 1 + message.data.split('/')[1][0].to_i
        #TODO we have to know which page is limit
        books = Bot::Book.search(query, page_to_look_for)
        books.each do |book|
          question << "/#{book.id} - #{book.title}"
          question << " - #{book.sub_title}" if book.respond_to?(:sub_title)
          question << "\n"
        end
        kb = [
          Telegram::Bot::Types::InlineKeyboardButton
            .new(text: 'Load more', callback_data: '"#{books[0].page}"')
        ]
        markup = Telegram::Bot::Types::InlineKeyboardMarkup.new(inline_keyboard: kb)<commit_msg>Fixing typos all night long pt2<commit_after>require 'telegram/bot'
require './lib/bot/it_ebook.rb'

token = YAML::load(IO.read('config/secrets.yml'))['telegram_token']

Telegram::Bot::Client.run(token) do |bot|
  bot.listen do |message|
    case message
    when Telegram::Bot::Types::CallbackQuery
      begin
        query = message.data.split('/')[0]
        page_to_look_for = 1 + message.data.split('/')[1][0].to_i
        #TODO we have to know which page is limit
        books = Bot::Book.search(query, page_to_look_for)
        books.each do |book|
          question = "/#{book.id} - #{book.title}"
          question << " - #{book.sub_title}" if book.respond_to?(:sub_title)
          question << "\n"
        end
        kb = [
          Telegram::Bot::Types::InlineKeyboardButton
            .new(text: 'Load more', callback_data: '"#{books[0].page}"')
        ]
        markup = Telegram::Bot::Types::InlineKeyboardMarkup.new(inline_keyboard: kb)
{'fraction_non_alphanumeric': 0.1602732527588019, 'fraction_numerical': 0.005780346820809248, 'mean_word_length': 2.854251012145749, 'pattern_counts': {'":': 0, '<': 13, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1226673', 'n_tokens_mistral': 627, 'n_tokens_neox': 625, 'n_words': 118}