Fix deprecated icon/username logic in Slack ()

* Fix deprecated icon/username logic in Slack

* hassfest
pull/34174/head
Aaron Bach 2020-04-13 15:32:23 -06:00 committed by GitHub
parent 59d707df54
commit b0bb125860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions
homeassistant/components/slack

View File

@ -74,11 +74,7 @@ class SlackNotificationService(BaseNotificationService):
self._default_channel = default_channel
self._hass = hass
self._icon = icon
if username or self._icon:
self._as_user = False
else:
self._as_user = True
self._username = username
async def _async_send_local_file_message(self, path, targets, message, title):
"""Upload a local file (with message) to Slack."""
@ -108,11 +104,11 @@ class SlackNotificationService(BaseNotificationService):
target: self._client.chat_postMessage(
channel=target,
text=message,
as_user=self._as_user,
attachments=attachments,
blocks=blocks,
icon_emoji=self._icon,
link_names=True,
username=self._username,
)
for target in targets
}