Skip to content

Commit

Permalink
beta 19/09/22
Browse files Browse the repository at this point in the history
  • Loading branch information
jumping2000 authored Sep 19, 2022
1 parent f5669ae commit 3186136
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions apps/notifier/notification_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def send_notify(self, data, notify_name, assistant_name: str):
caption = data["caption"]
link = data["link"]
html = data["html"]
priority = data["priority"]
pushover = data["pushover"]
mobile = data["mobile"]
whatsapp_addon = data["whatsapp"]
discord = data["discord"]
Expand Down Expand Up @@ -137,10 +139,13 @@ def send_notify(self, data, notify_name, assistant_name: str):
messaggio, titolo = self.prepare_text(html, message, title, timestamp, assistant_name)
titolo = titolo.replace("*","")
extra_data = {}
if image != "" and image.find("http") != -1:
extra_data.update({"url":image})
if image != "" and image.find("http") == -1:
extra_data.update({"attachment":image})
if isinstance(pushover, dict):
if image != "" and image.find("http") != -1:
extra_data.update({"url":image})
if image != "" and image.find("http") == -1:
extra_data.update({"attachment":image})
if priority != "":
extra_data.update({"priority":priority})
if extra_data:
self.call_service( item, message = messaggio, title = titolo, data = extra_data)
else:
Expand Down Expand Up @@ -222,14 +227,19 @@ def send_notify(self, data, notify_name, assistant_name: str):
self.call_service( item, message = messaggio, title = titolo, data = extra_data)
else:
self.call_service( item, message = messaggio, title = titolo)

#### GOTIFY ###########################
elif item.find("gotify") != -1:
messaggio, titolo = self.prepare_text(html, message, title, timestamp, assistant_name)
titolo = titolo.replace("*","")
if link !="":
messaggio = ("{} {}".format(messaggio,link))
self.call_service( item, message = messaggio, title = titolo)
if image !="" and caption !="":
messaggio = ("{} ![{}]({})".format(messaggio,caption,image))
elif image !="" :
messaggio = ("{} ![]({})".format(messaggio,image))
if priority !="":
self.call_service( item, message = messaggio, title = titolo, target = priority)
else:
self.call_service( item, message = messaggio, title = titolo)
#### other #########################
else:
if title != "":
Expand Down

0 comments on commit 3186136

Please sign in to comment.