From eb844201523ebab2c89263a20bf226354c31bb56 Mon Sep 17 00:00:00 2001 From: flifloo Date: Thu, 9 Jan 2020 09:50:00 +0100 Subject: [PATCH] Fix kfet and edt_notif --- TelegramEDT/base.py | 6 +++--- TelegramEDT/kfet.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/TelegramEDT/base.py b/TelegramEDT/base.py index 67b6432..ef6d346 100644 --- a/TelegramEDT/base.py +++ b/TelegramEDT/base.py @@ -2,7 +2,7 @@ import datetime import requests from feedparser import parse -from sqlalchemy import Column, Integer, String, Boolean, Date +from sqlalchemy import Column, Integer, String, Boolean, DateTime from sqlalchemy.ext.declarative import declarative_base from TelegramEDT.EDTcalendar import Calendar @@ -23,7 +23,7 @@ class User(Base): nt = Column(Boolean, default=False) nt_time = Column(Integer, default=20) nt_cooldown = Column(Integer, default=20) - nt_last = Column(Date, default=get_now) + nt_last = Column(DateTime, default=get_now) kfet = Column(Integer, default=0) await_cmd = Column(String, default="") tomuss_rss = Column(String) @@ -38,7 +38,7 @@ class User(Base): c = self.calendar(pass_week=False) for e in c.timeline: if 0 < (e.begin - now).total_seconds() // 60 <= self.nt_time and \ - 0 < (now - self.nt_last).total_seconds() // 60 >= self.nt_cooldown: + 0 < (now.replace(tzinfo=None) - self.nt_last).total_seconds() // 60 >= self.nt_cooldown: self.nt_last = get_now() return e return None diff --git a/TelegramEDT/kfet.py b/TelegramEDT/kfet.py index 0b40704..dac9997 100644 --- a/TelegramEDT/kfet.py +++ b/TelegramEDT/kfet.py @@ -94,6 +94,7 @@ async def notif(): else: kf = lang(u, "kfet_err") await bot.send_message(u.id, kf, parse_mode=ParseMode.MARKDOWN) + session.commit() def load():