Method: BubBot::Slack::CommandParser.get_command

Defined in:
lib/bub_bot/slack/command_parser.rb

.get_command(string_input) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bub_bot/slack/command_parser.rb', line 8

def self.get_command(string_input)
  puts "Parsing #{string_input}"
  #puts "options: #{command_classes}"

  # Strip the bot name out
  string_input.sub!(/^#{BubBot.configuration.bot_name} /, '')

  command = string_input.split(' ').first

  if command
    command_classes.find do |command_class|
      command_class.can_handle?(command)
    end
  else
    nil
  end
end