 # Commands:
 #   hubot steam id [me] <custom URL> - Returns the Steam ID for the user under http://steamcommunity.com/id/<custom URL>
 #   hubot steam status <Steam ID> - Returns <Steam ID> community status
-#   hubot dota history <Steam ID> - Returns metadata for the latest 5 game lobbies with <Steam ID>
+#   hubot dota history [-u] <Steam ID|custom URL> - Returns metadata for the latest 5 game lobbies with <Steam ID> or <custom URL> if the -u flag is set
 #   hubot dota match <match ID> [<Steam ID>] - Returns information about a particular <match ID>. Optionally, if <Steam ID> is included, its match information will also be returned
 #
 # Author:

            msg.reply "#{msg.match[1]} belongs to #{player.personaname} who is currently #{status} and was last online #{lastOnline}."
        , 2

    robot.respond /dota history (\d+)/i, (msg) ->
        steam_request msg, "/IDOTA2Match_570/GetMatchHistory", { account_id: msg.match[1], matches_requested: 5 }, (object) ->
            if object.result.status is 15
                msg.reply "The Steam ID you have entered (\"#{msg.match[1]}\") does not exist or it does not have match history enabled."
                return
            else if object.result.num_results is 0
                msg.reply "No game matches were found for the Steam ID: #{msg.match[1]}."
                return

            communityID = getCommunityID(msg.match[1])

            for match in object.result.matches
                hero = "N/A"
                start = moment.unix(match.start_time).fromNow()

                for player in match.players
                    if player.account_id is communityID
                        hero = getHero(player.hero_id).localized_name
                        break;

                msg.send "Match ID: #{match.match_id} | Lobby: #{lobbies[match.lobby_type]} | Hero: #{hero} | #{start}"

    robot.respond /dota match (\d+)( \d*)?/i, (msg) ->
        steam_request msg, "/IDOTA2Match_570/GetMatchDetails", match_id: msg.match[1], (object) ->

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