Class: Lita::Adapters::Slack::MessageHandler Private

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/adapters/slack/message_handler.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(robot, robot_id, data) ⇒ MessageHandler

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MessageHandler.


6
7
8
9
10
11
# File 'lib/lita/adapters/slack/message_handler.rb', line 6

def initialize(robot, robot_id, data)
  @robot = robot
  @robot_id = robot_id
  @data = data
  @type = data["type"]
end

Instance Method Details

#handleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/lita/adapters/slack/message_handler.rb', line 13

def handle
  case type
  when "hello"
    handle_hello
  when "message"
    handle_message
  when "reaction_added", "reaction_removed"
    handle_reaction
  when "user_change", "team_join"
    handle_user_change
  when "bot_added", "bot_changed"
    handle_bot_change
  when "channel_created", "channel_rename", "group_rename"
    handle_channel_change
  when "error"
    handle_error
  else
    handle_unknown
  end
end