Make Discord payload data key not required (#23964)
This commit is contained in:
parent
4583638b92
commit
a99e15343c
1 changed files with 11 additions and 12 deletions
|
@ -53,21 +53,20 @@ class DiscordNotificationService(BaseNotificationService):
|
|||
_LOGGER.error("No target specified")
|
||||
return None
|
||||
|
||||
if ATTR_DATA in kwargs:
|
||||
data = kwargs.get(ATTR_DATA)
|
||||
data = kwargs.get(ATTR_DATA) or {}
|
||||
|
||||
if ATTR_IMAGES in data:
|
||||
images = list()
|
||||
if ATTR_IMAGES in data:
|
||||
images = list()
|
||||
|
||||
for image in data.get(ATTR_IMAGES):
|
||||
image_exists = await self.hass.async_add_executor_job(
|
||||
self.file_exists,
|
||||
image)
|
||||
for image in data.get(ATTR_IMAGES):
|
||||
image_exists = await self.hass.async_add_executor_job(
|
||||
self.file_exists,
|
||||
image)
|
||||
|
||||
if image_exists:
|
||||
images.append(image)
|
||||
else:
|
||||
_LOGGER.warning("Image not found: %s", image)
|
||||
if image_exists:
|
||||
images.append(image)
|
||||
else:
|
||||
_LOGGER.warning("Image not found: %s", image)
|
||||
|
||||
# pylint: disable=unused-variable
|
||||
@discord_bot.event
|
||||
|
|
Loading…
Add table
Reference in a new issue