         text = packet.message.text
         if @selfMention == text.substr 0, @selfMention.length
           text = @robot.name + text.substr @selfMention.length
-        message = new QuipTextMessage user, text, packet.message
+        message = new QuipTextMessage user, text, packet
         @robot.receive message
       else
         @robot.logger.info "Got %s", packet.type

      else
        text.push(msg)
    return unless text.length or attachments.length
    options =
        threadId: envelope.room
        serviceId: envelope.message.id
    options.attachments = attachments.join "," if attachments.length
    options.content = text.join "\n\n" if text.length
    if envelope.message.quipMessage.annotation
        options.annotationId = envelope.message.quipMessage.annotation.id
    @robot.logger.info "Sending to #{envelope.room}: #{JSON.stringify(options)}"
    @client.newMessage options, @messageSent


WebSocket = require "ws"

class QuipTextMessage extends TextMessage
  constructor: (@user, @text, @quipPacket) ->
    super @user, @text, @quipPacket.message.id

class QuipHubot extends Adapter
  constructor: (robot) ->
