Commit d5f5f8d6 authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

cleanup

parent ed9d4cf2
...@@ -14,7 +14,6 @@ reGame = re.compile('\s*([0-9.]+)\s+([0-9a-fA-F]+)\s+"(.*?)"' ...@@ -14,7 +14,6 @@ reGame = re.compile('\s*([0-9.]+)\s+([0-9a-fA-F]+)\s+"(.*?)"'
reSummary = re.compile('^\s*(.*)\*\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+' reSummary = re.compile('^\s*(.*)\*\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+'
'([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+MG\-on.*$',re.MULTILINE) '([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+MG\-on.*$',re.MULTILINE)
oldGames=[]
games=[] games=[]
recentlySaid=[] recentlySaid=[]
lastData = "" lastData = ""
...@@ -88,7 +87,7 @@ async def on_ready(): ...@@ -88,7 +87,7 @@ async def on_ready():
@tasks.loop(seconds=15.0) @tasks.loop(seconds=15.0)
async def status_task(): async def status_task():
global oldGames, games, cnt, currentGames, recentlySaid global games, cnt, currentGames, recentlySaid
data = requests.get("https://www.managames.com/tennis/online/TE4_ServerList.php?Poll=1") data = requests.get("https://www.managames.com/tennis/online/TE4_ServerList.php?Poll=1")
info = parse_server_poll(data.text.replace('\n',' ')) info = parse_server_poll(data.text.replace('\n',' '))
games = info['games'] games = info['games']
...@@ -114,9 +113,8 @@ async def status_task(): ...@@ -114,9 +113,8 @@ async def status_task():
s = f"{players[0]} started a game with {players[1]}." s = f"{players[0]} started a game with {players[1]}."
currentGames[game['name']] = game currentGames[game['name']] = game
else: else:
# pprint.pprint(game)
try: 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']]}.)" s = f"{game['name']} (elo: {game['elo']}, rep: {game['reputation']}%) wants to play a {game['game_info']['nb_set']}-set match. (Preview: {previewStrings[game['game_info']['preview']]}. Control: {controlStrings[game['game_info']['control_mode']]}. Skill: {skillStrings[game['game_info']['skill_mode']]}.)"
except: except:
pprint.pprint(game) pprint.pprint(game)
s = "" s = ""
...@@ -128,14 +126,9 @@ async def status_task(): ...@@ -128,14 +126,9 @@ async def status_task():
if len(recentlySaid) > 5: if len(recentlySaid) > 5:
recentlySaid = recentlySaid[-5:] recentlySaid = recentlySaid[-5:]
if len(out) > 0: for line in out:
pprint.pprint(out) pprint.pprint(line)
await ch.send("\n".join(out)) await ch.send(line)
oldGames = [sorted([str(y) for y in x.values()]) for x in games]
# oldGames += newGames
# oldGames =
# if (len(oldGames)>10):
# oldGames=oldGames[-10:]
if len(games) == 0: if len(games) == 0:
recentlySaid = [] 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