<commit_before>require 'yaml'

module Lita
  module Handlers
    class Ambush < Handler

      route(/^ambush\s+(\S+):?\s*(.+)/, :ambush, command: true, help: { "ambush USER: message" => "Ambushes the USER with the message you leave."} )
      route(/./, :response)

      def ambush(request)
        ambushee = request.matches[0][0]
        ambushee = ambushee[1..-1] if ambushee.start_with? "@"
        store_hash = {
          time: Time.now.to_i,
          msg: request.matches[0][1],
          ambusher: request.user.name
        }.to_yaml
        log.debug(ambushee)
        redis.lpush(ambushee,store_hash)
        request.reply_with_mention("I've stored the ambush")
      end

      def response(request)
        unless request.message.body.start_with? "ambush"
          require 'pry'; binding.pry
          stored_yaml = redis.rpop(request.user.mention_name)
          while not stored_yaml.nil? do
            outputted_yaml=YAML.load(stored_yaml)
            request.reply_with_mention("While you were out, #{outputted_yaml[:ambusher]} said: #{outputted_yaml[:msg]}")
            stored_yaml = redis.rpop(request.user.mention_name)
          end
        end
      end

    end

    Lita.register_handler(Ambush)
  end
end<commit_msg>forgot to remove pry<commit_after>require 'yaml'

module Lita
  module Handlers
    class Ambush < Handler

      route(/^ambush\s+(\S+):?\s*(.+)/, :ambush, command: true, help: { "ambush USER: message" => "Ambushes the USER with the message you leave."} )
      route(/./, :response)

      def ambush(request)
        ambushee = request.matches[0][0]
        ambushee = ambushee[1..-1] if ambushee.start_with? "@"
        store_hash = {
          time: Time.now.to_i,
          msg: request.matches[0][1],
          ambusher: request.user.name
        }.to_yaml
        log.debug(ambushee)
        redis.lpush(ambushee,store_hash)
        request.reply_with_mention("I've stored the ambush")
      end

      def response(request)
        unless request.message.body.start_with? "ambush"
          stored_yaml = redis.rpop(request.user.mention_name)
          while not stored_yaml.nil? do
            outputted_yaml=YAML.load(stored_yaml)
            request.reply_with_mention("While you were out, #{outputted_yaml[:ambusher]} said: #{outputted_yaml[:msg]}")
            stored_yaml = redis.rpop(request.user.mention_name)
          end
        end
      end

    end

    Lita.register_handler(Ambush)
  end
end
{'fraction_non_alphanumeric': 0.12022745735174654, 'fraction_numerical': 0.00487408610885459, 'mean_word_length': 2.4208333333333334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '330683', 'n_tokens_mistral': 841, 'n_tokens_neox': 812, 'n_words': 161}