Sha256: 53c374ad5ae7bd70768a71dbd10b5b3e514e00845e50b3d620c6a3d2619e89e2

Contents?: true

Size: 540 Bytes

Versions: 5

Compression:

Stored size: 540 Bytes

Contents

module Boty
  class Message
    attr_accessor :text, :user, :channel, :ts, :team
    attr_reader :match

    def initialize(data, match: nil)
      @text = data["text"]
      @user = Slack.users.info data["user"]
      @channel = data["channel"]
      @ts = data["ts"]
      @team = data["team"]
      @match = match
    end

    def match!(regex)
      @match = regex.match @text
    end

    def from?(author)
      if author.respond_to? :id
        @user.id == author.id
      else
        @user.id == author
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
boty-0.0.17.1 lib/boty/message.rb
boty-0.0.17 lib/boty/message.rb
boty-0.0.16 lib/boty/message.rb
boty-0.0.15 lib/boty/message.rb
boty-0.0.14 lib/boty/message.rb