Method: Warchat::Chat::Client#chat

Defined in:
lib/warchat/chat/client.rb

#chat(response) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/warchat/chat/client.rb', line 63

def chat response
  response.extend(Warchat::Chat::ChatResponse)
  if response.ack?
    on_ack and on_ack.call response
  elsif response.message?
    message = Warchat::Chat::Message.new(response)
    @last_whisper = message if message.whisper?
    [on_message,send("on_message_#{message.type}".to_sym)].compact.each do |m| m.call(message) end
  elsif response.presence?
    chat_presence Warchat::Chat::Presence.new(response)
  else
    Warchat.debug "unhandled chat type: #{response.chat_type}"
  end
end