Sha256: cc35afdca5f84d30fadd0c0c32020c50ce496b03e40086a137fec9dce9d9cefd

Contents?: true

Size: 641 Bytes

Versions: 3

Compression:

Stored size: 641 Bytes

Contents

require 'nico/aliases'
require 'nico/matchers/daft_punk_matcher'

module Nico
  class Message
    attr_reader :body

    def initialize(json)
      # also available: id, user_id, starred, created_at, type, room_id
      @body = json['body'] || ''
    end

    def relevant?
      @body.start_with? *Nico::ALIASES
    end

    def response
      # This should loop through the regex and respond adequately
      # And one of these regex will add to the regex (and save to github)
      case @body
        when Matchers::DaftPunkMatcher.match then Matchers::DaftPunkMatcher.response
        else "You said #{@body}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nico-0.1.1 lib/nico/message.rb
nico-0.1.0 lib/nico/message.rb
nico-0.0.2 lib/nico/message.rb