Improve logging.

This commit is contained in:
Alexandr
2019-05-17 14:21:38 +03:00
parent a6d7903c57
commit a80b915d10
4 changed files with 9 additions and 4 deletions

View File

@ -109,7 +109,8 @@ class DataBase:
def add_alert(self, user_id, conf_id, alert_time, message):
date = int(dt.datetime.now().strftime("%s"))
if len(alert_time) < 4:
print(alert_time)
if alert_time[0] == '+':
alert_time = (dt.datetime.now() + dt.timedelta(minutes=int(alert_time[1:]))).strftime("%H%M")
sql = """INSERT OR IGNORE INTO
alert('conf_id', 'user_id', 'created', 'time', 'message')