Skip to content

Commit

Permalink
Merge branch 'main' into file_upload
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mer authored Aug 13, 2024
2 parents 1c47300 + 38de319 commit d546647
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/greenapi/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/t0mer/green-api-custom-notifier",
"requirements": ["whatsapp-api-client-python"],
"version": "0.3.0"
"version": "0.4.0"
}
7 changes: 4 additions & 3 deletions custom_components/greenapi/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def send_message(self, message="", **kwargs):
title = kwargs.get(ATTR_TITLE)
if title is not None:
title = f"*{title}*"
message = f"{title} \n {message}"
message = f"{title}\n{message}"
data = kwargs.get(ATTR_DATA)
target = kwargs.get(ATTR_TARGET)[0] if kwargs.get(ATTR_TARGET) is not None else self._target #Allow setting the target from either the service-call or the service config. Service call target can override the default config.
_LOGGER.info(f"Sending message to {target}")
Expand All @@ -66,6 +66,7 @@ def send_message(self, message="", **kwargs):
return
else:
_LOGGER.warn("Sending message to %s: excluding the file '%s' that was not found", kwargs.get(ATTR_TARGET)[0], file_path)
self._greenAPI.sending.sendMessage(target, message)
self._greenAPI.sending.sendMessage(target, message, linkPreview=False)
except Exception as e:
_LOGGER.error("Sending message to %s: has failed with the following error %s", kwargs.get(ATTR_TARGET)[0], str(e))
_LOGGER.error("Sending message to %s: has failed with the following error %s", kwargs.get(ATTR_TARGET)[0], str(e))

0 comments on commit d546647

Please sign in to comment.