Add +min feature to alert

This commit is contained in:
Alexandr
2019-01-26 14:31:01 +03:00
parent b990f3eec8
commit a6d7903c57
2 changed files with 11 additions and 4 deletions

View File

@ -109,6 +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:
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')
VALUES ('%s','%s','%s','%s','%s')""" % (
@ -118,7 +120,6 @@ class DataBase:
alert_time,
message
)
print('ALERT: ', sql)
self.execute(sql)
def get_top(self, user_id, conf_id, limit=10):