<commit_before>require 'line/bot'
require 'cabot/core/command_processor'

module Cabot
  class Cabot
    def initialize(channel_secret, channel_token)
      @client = Line::Bot::Client.new { |config|
        config.channel_secret = channel_secret
        config.channel_token = channel_token
      }
      @reply_token = nil
    end

    def handle(request)
      body = request.body.read

      signature = request.env['HTTP_X_LINE_SIGNATURE']
      unless client.validate_signature(body, signature)
        return false
      end

      events = client.parse_events_from(body)
      events.map do |event|
        case event
        when Line::Bot::Event::Message
          case event.type
          when Line::Bot::Event::MessageType::Text
            @reply_token = event['replyToken']
            send_messages Core::CommandProcessor.match event
          end
        end
      end
    end

    def send_messages(messages = [])
      if messages.any?
        client.reply_message(reply_token, messages) 
        return true
      end
      false
    end

    def client
      @client
    end

    def reply_token
      @reply_token
    end

  end
end<commit_msg>Fixed test<commit_after>require 'line/bot'
require 'cabot/core/command_processor'

module Cabot
  class Cabot
    def initialize(channel_secret, channel_token)
      @client = Line::Bot::Client.new { |config|
        config.channel_secret = channel_secret
        config.channel_token = channel_token
      }
      @reply_token = nil
    end

    def handle(request)
      body = request.body.read

      signature = request.env['HTTP_X_LINE_SIGNATURE']
      unless client.validate_signature(body, signature)
        return false
      end

      events = client.parse_events_from(body)
      events.map do |event|
        case event
        when Line::Bot::Event::Message
          case event.type
          when Line::Bot::Event::MessageType::Text
            @reply_token = event['replyToken']
            send_messages Core::CommandProcessor.match event.message[:text]
          end
        end
      end
    end

    def send_messages(messages = [])
      if messages && messages.any?
        client.reply_message(reply_token, messages)
        return true
      end
      false
    end

    def client
      @client
    end

    def reply_token
      @reply_token
    end

  end
end
{'fraction_non_alphanumeric': 0.0781316348195329, 'fraction_numerical': 0.0, 'mean_word_length': 2.2185792349726774, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4695543', 'n_tokens_mistral': 670, 'n_tokens_neox': 656, 'n_words': 153}