Skip to content

Commit

Permalink
feat(notifications): Fire notification as soon as an appointment was …
Browse files Browse the repository at this point in the history
…found (#474)

* Added title to telegram notification message

* Fire notification as soon as an appointment was found
  • Loading branch information
thecodingdad committed Jun 15, 2021
1 parent eb2f22b commit 2db7f78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tools/its.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,11 +970,15 @@ def reservierung_finden_mit_code(
tp_angenommen = choice(terminpaare_angenommen)
self.log.success(f"Termin gefunden!")
self.log.success(f"'{zentrumsname}' in {plz} {ort}")
msg = f"'{zentrumsname}' in {plz} {ort}\n"
for num, termin in enumerate(tp_angenommen, 1):
ts = datetime.fromtimestamp(termin["begin"] / 1000).strftime(
'%d.%m.%Y um %H:%M Uhr')
self.log.success(f"{num}. Termin: {ts}")
msg += f"{num}. Termin: {ts}\n"
self.log.success(f"Link: {url}impftermine/suche/{code}/{plz}")
msg += f"Link: {url}impftermine/suche/{code}/{plz}"
self.notify(title="Termin gefunden:", msg=msg)

# Reservierungs-Objekt besteht aus Terminpaar und Impfzentrum
return {
Expand Down
2 changes: 1 addition & 1 deletion tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def fire_notifications(notifications: dict, operating_system: str, title: str, m
if 'pushover' in notifications:
pushover_notification(notifications["pushover"], title, message)
if 'telegram' in notifications:
telegram_notification(notifications["telegram"], message)
telegram_notification(notifications["telegram"], title + "\n" + message)


def unique(seq):
Expand Down

0 comments on commit 2db7f78

Please sign in to comment.