def parse_command(sender, message) #:nodoc:
      is_master = master?(sender)

      if @config[:is_public] || is_master
        @commands[:spec].each do |command|
          if command[:is_public] || is_master
            match = message.strip.match(command[:regex])

            unless match.nil?
              params = match.captures                     # Pass an array,
              params = params.pop if params.count < 2     # a string, or nil.

              response = command[:callback].call(sender, params)
              deliver(sender, response) unless response.nil?

              return
            end
          end
        end

        if @config[:misunderstood_message]
          response = "I don't understand '#{message.strip}' Try saying 'help' " +
              "to see what commands I understand."
          deliver(sender, response)
        end
      end
    end
def parse_command(sender, message) #:nodoc:
      is_master = master?(sender)

      if @config[:is_public] || is_master
        @commands[:spec].each do |command|
          if command[:is_public] || is_master
            match = message.strip.match(command[:regex])

            unless match.nil?
              params = match.captures                     # Pass an array,
              params = params.pop if params.count < 2     # a string, or nil.

              response = command[:callback].call(sender, params)
              deliver(sender, response) unless response.nil?

              return
            end
          end
        end

        if @config[:misunderstood_message]
          response = "I don't understand '#{message.strip}' Try saying 'help' " +
              "to see what commands I understand."
          deliver(sender, response)
        end
      end
    end
Parses the given command message for the presence of a known command by
 testing it against each known command's regex. If a known command is
 found, the command parameters are parsed from groups defined in the
 regex, if any. They are passed on to the callback block this way:
 +nil+ if there's no parameter, a String if there's just one occurrence,
 or an Array if there's more than one occurence.

 If the callback returns a non- +nil+ value, it will be delivered to the
 sender.

 If an unkown command is found, the bot will default to displaying the
 help message. You can disable this by setting +:misunderstood_message+
 to false in the bot configuration.

 If the bot has not been made public, commands from anyone other than the
 bot master(s) will be silently ignored.