mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Improve logging for Discord integration (#68160)
This commit is contained in:
parent
d8c966fd0a
commit
aa57907c18
@ -49,8 +49,12 @@ class DiscordNotificationService(BaseNotificationService):
|
||||
def file_exists(self, filename):
|
||||
"""Check if a file exists on disk and is in authorized path."""
|
||||
if not self.hass.config.is_allowed_path(filename):
|
||||
_LOGGER.warning("Path not allowed: %s", filename)
|
||||
return False
|
||||
return os.path.isfile(filename)
|
||||
if not os.path.isfile(filename):
|
||||
_LOGGER.warning("Not a file: %s", filename)
|
||||
return False
|
||||
return True
|
||||
|
||||
async def async_send_message(self, message, **kwargs):
|
||||
"""Login to Discord, send message to channel(s) and log out."""
|
||||
@ -98,8 +102,6 @@ class DiscordNotificationService(BaseNotificationService):
|
||||
|
||||
if image_exists:
|
||||
images.append(image)
|
||||
else:
|
||||
_LOGGER.warning("Image not found: %s", image)
|
||||
|
||||
await discord_bot.login(self.token)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user