diff --git a/discordbot.py b/discordbot.py index 876f74ab..ee7dd1a6 100644 --- a/discordbot.py +++ b/discordbot.py @@ -572,7 +572,8 @@ class RoyalDiscordBot(discord.Client): halloween = await loop.run_in_executor(executor, session.query(db.Halloween) .filter_by(royal=enqueuer.royal) .one_or_none) - halloween[5] = datetime.datetime.now() + if halloween is not None: + halloween[5] = datetime.datetime.now() # END await loop.run_in_executor(executor, session.commit) await loop.run_in_executor(executor, session.close) diff --git a/webserver.py b/webserver.py index 0c44ad3f..5e0f6e0f 100644 --- a/webserver.py +++ b/webserver.py @@ -373,6 +373,13 @@ def ses_identify(): royal = db_session.query(db.Royal).filter_by(id=fl_session.get("user_id")).one_or_none() halloween = db_session.query(db.Halloween).filter_by(royal=royal).one_or_none() if halloween is None: + if not fl_g.event_started: + try: + telegram_bot.send_message(config["Telegram"]["main_group"], + f"💀 Che le settimane dello spavento abbiano inizio!", + parse_mode="HTML", disable_web_page_preview=True) + except Exception: + pass halloween = db.Halloween(royal=royal, first_trigger=datetime.datetime.now()) db_session.add(halloween) db_session.commit()