From 8682cfac95ec25d2c17800f828cdf997d76cbfa4 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 12 Oct 2018 18:49:17 +0200 Subject: [PATCH] updates --- db.py | 11 ++++++----- discordbot.py | 11 ----------- owlcaptain.py | 7 +++++-- templates/owlcaptain.html | 17 ++++++++++++++++- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/db.py b/db.py index 202299f7..468ccd45 100644 --- a/db.py +++ b/db.py @@ -996,11 +996,12 @@ class Halloween(Base): if self[3] is None: # osu! sss osu = session.query(Osu).join(Royal).filter_by(id=self.royal.id).one_or_none() - r = requests.get(f"https://osu.ppy.sh/api/get_scores" - f"?k={config['Osu!']['ppy_api_key']}&b=2038&u={osu.osu_id}") - j = r.json() - if len(j) > 0: - self[3] = datetime.datetime.now() + if osu is not None: + r = requests.get(f"https://osu.ppy.sh/api/get_scores" + f"?k={config['Osu!']['ppy_api_key']}&b=2038&u={osu.osu_id}") + j = r.json() + if len(j) > 0: + self[3] = datetime.datetime.now() # If run as script, create all the tables in the db diff --git a/discordbot.py b/discordbot.py index ee7dd1a6..fc34d818 100644 --- a/discordbot.py +++ b/discordbot.py @@ -711,17 +711,6 @@ class RoyalDiscordBot(discord.Client): await self.add_video_from_url(radio_message) await channel.send(f"📻 Aggiunto un messaggio radio, disattiva con `!radiomessages off`.") logger.info(f"Radio message added to the queue.") - # HALLOWEEN - if not random.randrange(4): - self.video_queue.insert(0, SecretVideo(file="despair.ogg", enqueuer=None)) - target = random.sample([m for m in self.main_guild.members if len(m.roles) > 1], 1)[0] - logger.debug(f"Despair roll successful, sending to {target.name}.") - if target.dm_channel is None: - await target.create_dm() - await target.dm_channel.send(random.sample(images, 1)[0]) - else: - logger.debug("Despair roll failed.") - # END # Parse the parameter as URL url = re.match(r"(?:https?://|ytsearch[0-9]*:).*", " ".join(params[1:]).strip("<>")) if url is not None: diff --git a/owlcaptain.py b/owlcaptain.py index 52a695e9..9e0e65da 100644 --- a/owlcaptain.py +++ b/owlcaptain.py @@ -24,6 +24,10 @@ sentry = Sentry(app, dsn=config["Sentry"]["token"]) @app.before_request def pre_request(): fl_g.event_started, fl_g.event_progress = db.Halloween.puzzle_status() + fl_g.all_moons_done = True + for moon in fl_g.event_progress: + if not moon: + fl_g.all_moons_done = False fl_g.time_left = datetime.datetime.fromtimestamp(1540999800) - datetime.datetime.now() fl_g.display_on_main_site = (fl_g.time_left < datetime.timedelta(days=7)) or __debug__ fl_g.css = "spoopy.less" if (fl_g.event_started or __debug__) else "nryg.less" @@ -70,8 +74,7 @@ def page_mansion(): @app.route("/whatpumpkin", methods=["POST"]) def page_whatpumpkin(): - abort(400) - return + return redirect("https://t.me/Steffo") if __name__ == "__main__": diff --git a/templates/owlcaptain.html b/templates/owlcaptain.html index fdae32d2..372b0da6 100644 --- a/templates/owlcaptain.html +++ b/templates/owlcaptain.html @@ -70,6 +70,21 @@ i'll reveal that when all others are complete, just to be safe.
+ {% if g.all_moons_done %} +
+
+ +
+

+ PERFORM THE RITUAL! +

+
+ if you have enough moons, prepare for a journey to the unknown.
+ when the time runs out, prepare for the ritual.
+ you'll receive the location through a safe channel, please do not spread it. +
+
+ {% endif %} {% for quest in g.event_progress %}
@@ -91,7 +106,7 @@ {% elif loop.index == 2 %} {# la zucca di balu e max #}

- carve the ritual pumpkin + ♦ carve the ritual pumpkin

prepare a pumpkin, and empty its inside.