From d8e71d269312c513bf20bfa0bc4d57271ca35548 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 5 Aug 2018 12:07:35 +0200 Subject: [PATCH] re-enable Overwatch, add 1 easter egg --- discordbot.py | 3 ++- update.py | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/discordbot.py b/discordbot.py index 30157a19..a2dc0331 100644 --- a/discordbot.py +++ b/discordbot.py @@ -614,7 +614,8 @@ song_special_messages = { "linkin park": ":arrow_forward: Crawling in my {song}!", "magicite": "⚠️ Warning: {song} contiene numerosi bug.", "papers please": ":arrow_forward: Glory to Arstotzka! {song}!", - "we are number one": ":arrow_forward: Now paying respect to Robbie Rotten: {song}" + "we are number one": ":arrow_forward: Now paying respect to Robbie Rotten: {song}", + "jump up superstar": ":arrow_forward: Is {song} the Tengen Toppa Guren Lagann opening?" } diff --git a/update.py b/update.py index 20588c84..232e37a8 100644 --- a/update.py +++ b/update.py @@ -88,21 +88,21 @@ try: sleep_time = 1 - time.clock() + t time.sleep(sleep_time if sleep_time > 0 else 0) # Update Overwatch - # print("OVERWATCH") - # for user in session.query(db.Overwatch).all(): - # t = time.clock() - # print(f"Updating {user.royal.username}", end="\t\t", flush=True) - # try: - # user.update() - # except errors.RequestError: - # print("Request Error") - # except errors.NotFoundError: - # print("Not Found Error (?)") - # else: - # print("OK") - # finally: - # sleep_time = 1 - time.clock() + t - # time.sleep(sleep_time if sleep_time > 0 else 0) + print("OVERWATCH") + for user in session.query(db.Overwatch).all(): + t = time.clock() + print(f"Updating {user.royal.username}", end="\t\t", flush=True) + try: + user.update() + except errors.RequestError: + print("Request Error") + except errors.NotFoundError: + print("Not Found Error (?)") + else: + print("OK") + finally: + sleep_time = 1 - time.clock() + t + time.sleep(sleep_time if sleep_time > 0 else 0) print("Committing...\t\t") session.commit() print("OK")