1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
This commit is contained in:
Steffo 2018-10-12 18:49:17 +02:00
parent ee354d3b45
commit 8682cfac95
4 changed files with 27 additions and 19 deletions

11
db.py
View file

@ -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

View file

@ -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:

View file

@ -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__":

View file

@ -70,6 +70,21 @@
i'll reveal that when all others are complete, just to be safe.
</div>
<div class="subquests">
{% if g.all_moons_done %}
<div class="quest">
<div class="progress">
<i class="far fa-moon todo"></i>
</div>
<h1>
PERFORM THE RITUAL!
</h1>
<div class="description">
if <a href="https://ryg.steffo.eu/game/halloween">you have enough moons</a>, prepare for a journey to the unknown.<br>
when the time runs out, prepare for the ritual.<br>
you'll receive the location through a safe channel, please do not spread it.
</div>
</div>
{% endif %}
{% for quest in g.event_progress %}
<div class="quest {% if quest %}quest-clear{% endif %}" id="{{ loop.index }}">
<div class="progress">
@ -91,7 +106,7 @@
{% elif loop.index == 2 %}
{# la zucca di balu e max #}
<h2>
carve the ritual pumpkin
<u title="updated"></u> carve the ritual pumpkin
</h2>
<div class="description">
prepare a pumpkin, and empty its inside.<br>