Commit 1a68168a authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

add additional game paramters to announcement

parent 63ecac56
......@@ -90,21 +90,14 @@ async def on_ready():
async def status_task():
global oldGames, games, cnt, currentGames, recentlySaid
data = requests.get("https://www.managames.com/tennis/online/TE4_ServerList.php?Poll=1")
# if cnt==0:
# info = parse_server_poll('0 10E1 "POLAND vs TennisStar" B180D41 12C 6AC 96 "" "6/3 4/6 7/6" 510 2 46 617DAC94 * 1 0 0 34 1ED48 0 MG-on'.replace('\n',' '))
# else:
info = parse_server_poll(data.text.replace('\n',' '))
# newGames = [{k:v for (k,v) in x.items() if k!= 'score'} for x in info['games']]
games = info['games']
# newGames = [x for x in newGames if x['score'] == '...' and sorted([str(y) for y in x.values()]) not in oldGames]
out=[]
nix=[]
previewStrings = ('None', 'Service', 'Service + Rally', 'All + Danger Zone', 'All + Danger Zone + Aiming')
skillStrings = ('Free', 'Fair', 'Realistic')
controlStrings = ('Simulation', 'Arcade', 'Elite')
# for game in info['games']:
# if "..." not in game['score'] and " -- " not in game['score'] and game['name'] in currentGames.keys():
# out += [f"The {game['name']} game is finished. The final score was {game['score']}."]
# pprint.pprint(currentGames)
# del currentGames[game['name']]
for ongoing in currentGames.keys():
if ongoing not in [x['name'] for x in games]:
out += [f"The {ongoing} game is finished. Final score: {currentGames[ongoing]['score']}"]
......@@ -120,7 +113,12 @@ async def status_task():
s = f"The {game['name']} match has begun."
currentGames[game['name']] = game
else:
s = f"{game['name']} (elo: {game['elo']}, rep: {game['reputation']}%) wants to play a {game['game_info']['nb_set']}-set match."
# pprint.pprint(game)
try:
s = f"{game['name']} (elo: {game['elo']}, rep: {game['reputation']}%) wants to play a {game['game_info']['nb_set']}-set match. (Control mode: {controlStrings[game['game_info']['control_mode']]}. Preview: {previewStrings[game['game_info']['preview']]}. Skill mode: {skillStrings[game['game_info']['skill_mode']]}.)"
except:
pprint.pprint(game)
s = ""
if len(game['tagline'])>0:
s += f" Comment: {game['tagline']}"
if s != "" and s not in recentlySaid:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment