Sha256: 0078a86ff09de6cbe4263e0a6775164483511a5daeff9cdb9b0a249f9bfb1df0

Contents?: true

Size: 676 Bytes

Versions: 2

Compression:

Stored size: 676 Bytes

Contents

module Lita
  module Handlers
    class Wit < Handler
      on :unhandled_message, :handle
      config :server_access_token, type: String, required: true

      def initialize(robot)
        super
        @bickle = Lita::Utils::Bickle.new(robot)
        @client = Lita::Services::WitClient.new(robot)
      end

      def handle(payload)
        message = payload[:message]
        return unless @bickle.you_talking_to_me?(message)
        respond(message)
      end

      private

      def respond(message)
        @client.run_actions session_id, message
      end

      def session_id
        'unique-1234'
      end

      Lita.register_handler(self)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lita-wit-0.1.1 lib/lita/handlers/wit.rb
lita-wit-0.1.0 lib/lita/handlers/wit.rb