Fix discord component using userid as target (#63972)
parent
a6fe1c24ab
commit
2df3c85ba6
|
@ -94,12 +94,13 @@ class DiscordNotificationService(BaseNotificationService):
|
||||||
for channelid in kwargs[ATTR_TARGET]:
|
for channelid in kwargs[ATTR_TARGET]:
|
||||||
channelid = int(channelid)
|
channelid = int(channelid)
|
||||||
try:
|
try:
|
||||||
channel = await discord_bot.fetch_channel(
|
channel = await discord_bot.fetch_channel(channelid)
|
||||||
channelid
|
|
||||||
) or await discord_bot.fetch_user(channelid)
|
|
||||||
except discord.NotFound:
|
except discord.NotFound:
|
||||||
_LOGGER.warning("Channel not found for ID: %s", channelid)
|
try:
|
||||||
continue
|
channel = await discord_bot.fetch_user(channelid)
|
||||||
|
except discord.NotFound:
|
||||||
|
_LOGGER.warning("Channel not found for ID: %s", channelid)
|
||||||
|
continue
|
||||||
# Must create new instances of File for each channel.
|
# Must create new instances of File for each channel.
|
||||||
files = [discord.File(image) for image in images] if images else None
|
files = [discord.File(image) for image in images] if images else None
|
||||||
await channel.send(message, files=files, embed=embed)
|
await channel.send(message, files=files, embed=embed)
|
||||||
|
|
Loading…
Reference in New Issue