 getSteamID = (msg, customURL, handler) ->
     steam_request msg, "/ISteamUser/ResolveVanityURL", vanityurl: customURL, (object) ->
         if object.response.success is 42
-            msg.reply "The custom URL you have entered (\"#{msg.match[2]}\") does not exist."
+            msg.reply "The custom URL you have entered (\"#{customURL}\") does not exist."
             return
 
         handler object.response.steamid
 
 getCommunityID = (steamID) ->
     # 64 -> 32
-    (steamID - 76561197960265728)
+    buffer = new Buffer 8
+    buffer.writeUInt64LE steamID, 0
+    buffer.readUInt32LE 0
 
 getHero = (heroID) ->
     return hero for hero in heroes when hero.id is heroID

module.exports = (robot) ->
    robot.respond /steam id( me)? (.*)/i, (msg) ->
        getSteamID msg, msg.match[2], (id) ->
            if id
                msg.match[2] += if msg.match[2].slice(-1) is "s" then "'" else "'s"
                msg.reply "#{msg.match[2]} Steam ID is: #{id}"

    robot.respond /steam status (\d+)/i, (msg) ->
        steam_request msg, "/ISteamUser/GetPlayerSummaries", steamids: msg.match[1], (object) ->

    4: "Co-op with bots"
    5: "Team match"
    6: "Solo queue"
    7: "Ranked match"
towers = [
    "Ancient top"
    "Ancient bottom"
