This repository contains a web app/API for chatbots for Age of Empires II streams. The API is developed in Python, and is designed to run on a remote server. Bots can then query pages for game and player information in response to viewer-issued commands.
This route gets a player's rated 1v1 ranking from aoe2.net and reports it back synchronously.
!commands add !elo $(urlfetch https://twitch.polskafan.de/elo?player=$(querystring)&default=mmarss)
!commands add !elo $(urlfetch https://twitch.polskafan.de/elo?player=$(querystring)&default_id=406827)
!commands add !rank -a=!elo $(query)
- ?player [optional] The current Steam name of a player.
- ?default The player to get if no player is specified. This should be the streamer's name.
- ?default_id [optional] The profile to get if no player is specified. Use the route /profile_id to get this value for a given person. This should be the streamer's id.
This route gets a player's rated team game ranking from aoe2.net and reports it back synchronously.
!commands add !tgelo $(urlfetch https://twitch.polskafan.de/tgelo?player=$(querystring)&default=mmarss)
!commands add !tgelo $(urlfetch https://twitch.polskafan.de/tgelo?player=$(querystring)&default_id=406827)
!commands add !elotg -a=!tgelo $(query)
!commands add !tgrank -a=!tgelo $(query)
- ?player [optional] The current Steam name of a player.
- ?default The player to get if no player is specified. This should be the streamer's name.
- ?default_id [optional] The profile to get if no player is specified. Use the route /profile_id to get this value for a given person. This should be the streamer's id.
This route balances a list of players for team games.
!commands add !balance $(urlfetch https://twitch.polskafan.de/balance?players=$(querystring))
- ?players A comma-delimited list of players to balance. All players should have at least a 1v1 or team game ranking. 4, 6, or 8 players should be provided. Informative error messages are returned if these conditions are not heeded.
This route gets information about the rankings of all players in a team game.
!commands add !judge $(urlfetch https://twitch.polskafan.de/judge?players=$(querystring))
- ?players A comma-delimited list of players in a team game. The list should consist of an even number of players, listing first all players of team 1, then of team 2.
This route looks up a player's most recent (or current) match, and returns information about the players and teams playing.
!commands add !match $(urlfetch https://twitch.polskafan.de/lastmatch?steam_id=76561199003184910)
!commands add !match $(urlfetch https://twitch.polskafan.de/lastmatch?profile_id=406827)
!commands add !match-id $(urlfetch https://twitch.polskafan.de/lastmatch?profile_id=$(querystring))
- ?steam_id The steam64 id to get the last match for. This should be the streamer's id. Note: A lookup via steam_id only works for players playing on the steam platform. Use the platform agnostic profile_id for other platforms (i.e. Xbox) instead.
- ?profile_id The profile to get the last match for. This should be the streamer's id.
- ?channel (optional) This is a random string used to link /castmatch to /lastmatch. For Nightbot, this works automatically, via Nightbot Request headers. For other bots just generate a random string and use it in both commands.
This route overwrites the default player in the /lastmatch route for a given channel. This is useful to temporarily change the requested player when games are casted. Once the default player starts a new match it should automatically clear any temporary overwrite. To manually clear the overwrite, use !castmatch clear.
Note: This command should be moderator only.
!commands add !castmatch $(urlfetch https://twitch.polskafan.de/castmatch?castplayer=$(querystring))
!commands add !castmatch $(urlfetch https://twitch.polskafan.de/castmatch?castplayer=$(querystring))&channel=EQ688erUmfuTw7nX
- ?castplayer The name of one of the players in the casted match
- ?channel (optional) This is a random string used to link /castmatch to /lastmatch. For Nightbot, this works automatically, via Nightbot request headers. For other bots just generate a random string and use it in both commands.
Similar to the /lastmatch route, but /matchhistory allows you to go back through older matches of a player. This can be used to create !match responses for games that were previously played.
!commands add !match $(urlfetch https://twitch.polskafan.de/lastmatch?steam_id=76561199003184910&start=2)
!commands add !match $(urlfetch https://twitch.polskafan.de/lastmatch?profile_id=406827&start=2)
- ?start The index of the match to return. For example start=2 returns the 2nd to last match of a player.
- ?steam_id The steam64 id to get the last match for. This should be the streamer's id. Note: A lookup via steam_id only works for players playing on the steam platform. Use the platform agnostic profile_id for other platforms (i.e. Xbox) instead.
- ?profile_id The profile to get the last match for. This should be the streamer's id.
This route calculates the daily score of the provided steam or profile ID. For this it gets the latest matches and then searches through all played ladders and sums up the wins, losses and elo difference.
!commands add !autoscore $(urlfetch https://twitch.polskafan.de/session?steam_id=76561199003184910)
!commands add !autoscore $(urlfetch https://twitch.polskafan.de/session?profile_id=406827)
- ?steam_id The steam64 id to get the daily results for. This should be the streamer's id. Note: A lookup via steam_id only works for players playing on the steam platform. Use the platform agnostic profile_id for other platforms (i.e. Xbox) instead.
- ?profile_id The profile to get the daily results for. This should be the streamer's id.
This route looks up the ID of the last completed match. It then returns a link to aoe2insights.com to the analysis page of that match.
!commands add !analysis $(urlfetch https://twitch.polskafan.de/analysis?steam_id=76561199003184910)
!commands add !analysis $(urlfetch https://twitch.polskafan.de/analysis?profile_id=406827)
- ?steam_id The steam64 id to get the last match for. This should be the streamer's id. Note: A lookup via steam_id only works for players playing on the steam platform. Use the platform agnostic profile_id for other platforms (i.e. Xbox) instead.
- ?profile_id The profile to get the last match for. This should be the streamer's id.
This route gets a player's profile id from their name.
!commands add !profile-id -ul=moderator $(urlfetch https://twitch.polskafan.de/profile_id?player=mmarss)
- ?player The current Steam name of a player.
This route returns a aoe2techree.net link to the player's current civ.
!commands add !civinfo $(urlfetch https://twitch.polskafan.de/civinfo?search=$(querystring)&steam_id=76561199003184910)
!commands add !civinfo $(urlfetch https://twitch.polskafan.de/civinfo?search=$(querystring)&profile_id=406827)
- ?search The player color or player name of the player the civ should be returned for. Searching for 2 would return the civ for the red player in the current game. A search string returns the player with the clostest name to the search string. No search returns the civ of the streamer (see ?steam_id and ?profile_id).
- ?steam_id The steam64 id to get the last match for. This should be the streamer's id. Note: A lookup via steam_id only works for players playing on the steam platform. Use the platform agnostic profile_id for other platforms (i.e. Xbox) instead.
- ?profile_id The profile to get the last match for. This should be the streamer's id.