Fix discord component using userid as target (#63972)

This commit is contained in:
kezziny 2022-01-12 14:37:22 +01:00 committed by GitHub
parent a6fe1c24ab
commit 2df3c85ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,9 +94,10 @@ class DiscordNotificationService(BaseNotificationService):
for channelid in kwargs[ATTR_TARGET]:
channelid = int(channelid)
try:
channel = await discord_bot.fetch_channel(
channelid
) or await discord_bot.fetch_user(channelid)
channel = await discord_bot.fetch_channel(channelid)
except discord.NotFound:
try:
channel = await discord_bot.fetch_user(channelid)
except discord.NotFound:
_LOGGER.warning("Channel not found for ID: %s", channelid)
continue