<commit_before>class Base
  def initialize
  end

  def run(tube, job)
    commands = job['body'].split(' ')
    main_command = commands[0]
    case main_command
    when '/hi'
      tube.put({type: 'simple', body: 'Hey, what\'s up?', address: job['address']}.to_json)
    when '/echo'
      tube.put({type: 'simple', body: job['body'], address: job['address']}.to_json)
    when '/image'
      tube.put({type: 'image', image: '/home/ubuntu/yowsup-queue-rails-demo/sample.jpg', address: job['address']}.to_json)
    when '/video'
      # To be implemented
    when '/h', '/help'
      #help commands
      help_text = %Q(
        [HELP] - Commands
        /help or /h - Show this message
        /hi - Replies Hey, what\'s up?
        /echo - Echo
        /image - Sends an images
      )
      tube.put({type: 'simple', body: help_text, address: job['address']}.to_json)
    else
      tube.put({type: 'simple', body: 'sorry, no command found', address: job['address']}.to_json)
    end
  end
end<commit_msg>echo and no cmd fix<commit_after>class Base
  def initialize
  end

  def run(tube, job)
    commands = job['body'].split(' ')
    main_command = commands[0]
    case main_command
    when '/hi'
      tube.put({type: 'simple', body: 'Hey, what\'s up?', address: job['address']}.to_json)
    when '/echo'
      cmd = job['body'].split(' ')[1..-1].join(' ')
      tube.put({type: 'simple', body: cmd, address: job['address']}.to_json)
    when '/image'
      tube.put({type: 'image', image: '/home/ubuntu/yowsup-queue-rails-demo/sample.jpg', address: job['address']}.to_json)
    when '/video'
      # To be implemented
    when '/h', '/help'
      #help commands
      help_text = %Q([HELP] - Commands

/help or /h - Show this message
/hi - Replies Hey, what\'s up?
/echo - Echo
/image - Sends an images)
      tube.put({type: 'simple', body: help_text, address: job['address']}.to_json)
    else
      if main_command[0] == '/'
        tube.put({type: 'simple', body: 'sorry, no command found', address: job['address']}.to_json)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.1738498789346247, 'fraction_numerical': 0.002421307506053269, 'mean_word_length': 2.729241877256318, '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': '5231747', 'n_tokens_mistral': 708, 'n_tokens_neox': 697, 'n_words': 188}