Module: Ruboty::SlackRTM::Client::ReactionAddedClient
- Included in:
- Ruboty::SlackRTM::Client
- Defined in:
- lib/ruboty/slack_reaction_added/extension/client.rb
Instance Method Summary collapse
-
#on_text(&block) ⇒ Object
def initialize(websocket_url:) Ruboty.logger.info websocket_url.to_s super(websocket_url: websocket_url) end.
Instance Method Details
#on_text(&block) ⇒ Object
def initialize(websocket_url:)
Ruboty.logger.info websocket_url.to_s
super(websocket_url: websocket_url)
end
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ruboty/slack_reaction_added/extension/client.rb', line 12 def on_text(&block) @client.on(:message) do || case .type when :ping Ruboty.logger.debug("#{Client.name}: Received ping message") send('', type: 'pong') when :pong Ruboty.logger.debug("#{Client.name}: Received pong message") when :text block.call(JSON.parse(.data)) when :reaction_added case .data.item.type when :message # Ruboty.logger.info message.data block.call(JSON.parse(.data)) else Ruboty.logger.warn("#{Client.name}: Received unknown reaction item type=#{.data.item.type}: #{.data}") end else Ruboty.logger.warn("#{Client.name}: Received unknown message type=#{.type}: #{.data}") end end end |