Sha256: f0a1fc7796c1c090ac0a6cfc916754c1f903e14f6c5099fc6df29afa0d335e55

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

Contents

module Lita
  # A wrapper object that provides the primary interface for handlers to
  # respond to incoming chat messages.
  class Response
    extend Forwardable

    # The incoming message.
    # @return [Lita::Message] The message.
    attr_accessor :message

    # An array of matches from running the message against the route pattern.
    # @return [Array<String>, Array<Array<String>>] The array of matches.
    attr_accessor :matches

    # @!method args
    #   @see Lita::Message#args
    # @!method reply
    #   @see Lita::Message#reply
    # @!method user
    #   @see Lita::Message#user
    def_delegators :message, :args, :reply, :user, :command?

    # @param message [Lita::Message] The incoming message.
    # @param matches [Array<String>, Array<Array<String>>] The Regexp matches.
    def initialize(message, matches: nil)
      self.message = message
      self.matches = matches
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-2.3.0 lib/lita/response.rb