mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix deprecated icon/username logic in Slack (#34156)
* Fix deprecated icon/username logic in Slack * hassfest
This commit is contained in:
parent
59d707df54
commit
b0bb125860
@ -74,11 +74,7 @@ class SlackNotificationService(BaseNotificationService):
|
|||||||
self._default_channel = default_channel
|
self._default_channel = default_channel
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
self._icon = icon
|
self._icon = icon
|
||||||
|
self._username = username
|
||||||
if username or self._icon:
|
|
||||||
self._as_user = False
|
|
||||||
else:
|
|
||||||
self._as_user = True
|
|
||||||
|
|
||||||
async def _async_send_local_file_message(self, path, targets, message, title):
|
async def _async_send_local_file_message(self, path, targets, message, title):
|
||||||
"""Upload a local file (with message) to Slack."""
|
"""Upload a local file (with message) to Slack."""
|
||||||
@ -108,11 +104,11 @@ class SlackNotificationService(BaseNotificationService):
|
|||||||
target: self._client.chat_postMessage(
|
target: self._client.chat_postMessage(
|
||||||
channel=target,
|
channel=target,
|
||||||
text=message,
|
text=message,
|
||||||
as_user=self._as_user,
|
|
||||||
attachments=attachments,
|
attachments=attachments,
|
||||||
blocks=blocks,
|
blocks=blocks,
|
||||||
icon_emoji=self._icon,
|
icon_emoji=self._icon,
|
||||||
link_names=True,
|
link_names=True,
|
||||||
|
username=self._username,
|
||||||
)
|
)
|
||||||
for target in targets
|
for target in targets
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user