Sha256: 942b55aea39bfd4245cad1ae0bbbfd3bda1fd9ec6913c8922a26ade1e4c4699b

Contents?: true

Size: 605 Bytes

Versions: 6

Compression:

Stored size: 605 Bytes

Contents

module Boty
  module Slack
    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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
boty-1.0.1 lib/boty/slack/message.rb
boty-1.0.0 lib/boty/slack/message.rb
boty-0.2.0 lib/boty/slack/message.rb
boty-0.1.2 lib/boty/slack/message.rb
boty-0.1.1 lib/boty/slack/message.rb
boty-0.1.0 lib/boty/slack/message.rb