1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

a tiny fix

This commit is contained in:
Steffo 2018-10-11 23:46:47 +02:00
parent 69176f60c5
commit ee354d3b45
2 changed files with 9 additions and 1 deletions

View file

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

View file

@ -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"💀 <b>Che le settimane dello spavento abbiano inizio!</b>",
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()