Commit 85df563f authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

had some fun with the win announcements

parent 07c4d224
......@@ -4,9 +4,14 @@ import re
import pprint
import requests
import platform
import random
from discord.ext import tasks, commands
from discord.ext.commands import Bot
winWords = ('annihilated', 'beat', 'won against', 'triumphed over', 'embarrassed', 'painted the court with', 'trounced', 'decisively won against', 'emasculated', 'eked out a win against', 'brushed off', 'destroyed', 'dominated', 'schooled')
reScore = re.compile('(\d)/(\d)')
reGame = re.compile('\s*([0-9.]+)\s+([0-9a-fA-F]+)\s+"(.*?)"'
......@@ -99,8 +104,33 @@ async def status_task():
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']}`"]
nix += [ongoing]
# out += [f"The {ongoing} game is finished. Final score: `{currentGames[ongoing]['score']}`"]
nix += [ongoing]
score = currentGames[ongoing]['score']
sets = [0, 0]
scoreLine = reScore.findall(score)
players = ongoing.split(" vs ")
for setScore in scoreLine:
gamePoints = [int(x) for x in setScore]
if gamePoints == sorted(gamePoints):
if sets[0]<sets[1]:
s = " ".join([x[::-1] for x in score.split(" ")])
(winner, loser) = players[::-1]
elif sets[0]>sets[1]:
s = score
(winner, loser) = players
s = s.replace("/", "-")
out += [f"{winner} {random.choice(winWords)} {loser}. Final score: `{s}`"]
except Exception as exc:
for xin in nix:
del currentGames[xin]
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