Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions homeassistant/components/discord/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,20 @@ async def async_send_message(self, message, **kwargs):
_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
Expand Down