build message, send at one point
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
15
bibcheck.py
15
bibcheck.py
@@ -55,16 +55,17 @@ def check(username, password, notify_ids):
|
|||||||
date = datetime.datetime.strptime(info[1], '%d.%m.%Y')
|
date = datetime.datetime.strptime(info[1], '%d.%m.%Y')
|
||||||
delta = date - datetime.datetime.now()
|
delta = date - datetime.datetime.now()
|
||||||
allinfo.append(str(info))
|
allinfo.append(str(info))
|
||||||
if (delta.days > 7 and delta.days <= 10) or delta.days == 20 or delta.days == 15:
|
if delta.days <= 10 or delta.days == 20 or delta.days == 15:
|
||||||
for client in itertools.chain(notify_ids, os.environ.get('PUSHOVER_CLIENTS', '').split(',')):
|
message = f'Bitte an {info[3]} denken\n'
|
||||||
try:
|
|
||||||
pushover.Client(client).send_message(f'Bitte an {info[3]} denken, Abgabe <b>{info[1]}</b> - {username}', title="Erinnerung", html=1)
|
|
||||||
except:
|
|
||||||
print("No client")
|
|
||||||
if delta.days <= 7:
|
if delta.days <= 7:
|
||||||
|
message += '<font color="#ff0000">'
|
||||||
|
message += 'Abgabe <b>{info[1]}</b>'
|
||||||
|
if delta.days <= 7:
|
||||||
|
message += '</font>'
|
||||||
|
message += ' - {username}'
|
||||||
for client in itertools.chain(notify_ids, os.environ.get('PUSHOVER_CLIENTS', '').split(',')):
|
for client in itertools.chain(notify_ids, os.environ.get('PUSHOVER_CLIENTS', '').split(',')):
|
||||||
try:
|
try:
|
||||||
pushover.Client(client).send_message(f'Bitte an {info[3]} denken, <font color="#ff0000">Abgabe <b>{info[1]}</b></font> - {username}', title="Erinnerung", html=1)
|
pushover.Client(client).send_message(message, title="Erinnerung", html=1)
|
||||||
except:
|
except:
|
||||||
print("No client")
|
print("No client")
|
||||||
except (StopIteration, mechanize._mechanize.LinkNotFoundError) as e:
|
except (StopIteration, mechanize._mechanize.LinkNotFoundError) as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user