 Robot = require '../robot'
 HTTP  = require 'http'
-Qs    = require 'querystring'
+QS    = require 'querystring'
 
 class Twilio extends Robot
   constructor: ->


  send: (user, strings...) ->
    message = strings.join "\n"
    console.log "Sending reply SMS: #{message} to #{user.id}"
    @send_sms message, user.id, (err, body) =>
      if err or not body?
        console.log "error sending reply SMS: #{err}"

  reply: (user, strings...) ->
    for str in strings


  run: ->
    server = HTTP.createServer (request, response) =>
      payload = QS.parse(request.url)

      if payload.Body? and payload.From?
        console.log "Received SMS: #{payload.Body} from #{payload.From}"
