mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Make Discord payload data key not required (#23964)
This commit is contained in:
parent
4583638b92
commit
a99e15343c
@ -53,21 +53,20 @@ class DiscordNotificationService(BaseNotificationService):
|
|||||||
_LOGGER.error("No target specified")
|
_LOGGER.error("No target specified")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if ATTR_DATA in kwargs:
|
data = kwargs.get(ATTR_DATA) or {}
|
||||||
data = kwargs.get(ATTR_DATA)
|
|
||||||
|
|
||||||
if ATTR_IMAGES in data:
|
if ATTR_IMAGES in data:
|
||||||
images = list()
|
images = list()
|
||||||
|
|
||||||
for image in data.get(ATTR_IMAGES):
|
for image in data.get(ATTR_IMAGES):
|
||||||
image_exists = await self.hass.async_add_executor_job(
|
image_exists = await self.hass.async_add_executor_job(
|
||||||
self.file_exists,
|
self.file_exists,
|
||||||
image)
|
image)
|
||||||
|
|
||||||
if image_exists:
|
if image_exists:
|
||||||
images.append(image)
|
images.append(image)
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning("Image not found: %s", image)
|
_LOGGER.warning("Image not found: %s", image)
|
||||||
|
|
||||||
# pylint: disable=unused-variable
|
# pylint: disable=unused-variable
|
||||||
@discord_bot.event
|
@discord_bot.event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user