diff --git a/homeassistant/components/discord/notify.py b/homeassistant/components/discord/notify.py index 41137e1a32c..2e13b68225c 100644 --- a/homeassistant/components/discord/notify.py +++ b/homeassistant/components/discord/notify.py @@ -20,9 +20,13 @@ _LOGGER = logging.getLogger(__name__) ATTR_EMBED = "embed" ATTR_EMBED_AUTHOR = "author" +ATTR_EMBED_COLOR = "color" +ATTR_EMBED_DESCRIPTION = "description" ATTR_EMBED_FIELDS = "fields" ATTR_EMBED_FOOTER = "footer" +ATTR_EMBED_TITLE = "title" ATTR_EMBED_THUMBNAIL = "thumbnail" +ATTR_EMBED_URL = "url" ATTR_IMAGES = "images" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({vol.Required(CONF_TOKEN): cv.string}) @@ -64,10 +68,16 @@ class DiscordNotificationService(BaseNotificationService): embeds: list[nextcord.Embed] = [] if ATTR_EMBED in data: embedding = data[ATTR_EMBED] + title = embedding.get(ATTR_EMBED_TITLE) or nextcord.Embed.Empty + description = embedding.get(ATTR_EMBED_DESCRIPTION) or nextcord.Embed.Empty + color = embedding.get(ATTR_EMBED_COLOR) or nextcord.Embed.Empty + url = embedding.get(ATTR_EMBED_URL) or nextcord.Embed.Empty fields = embedding.get(ATTR_EMBED_FIELDS) or [] if embedding: - embed = nextcord.Embed(**embedding) + embed = nextcord.Embed( + title=title, description=description, color=color, url=url + ) for field in fields: embed.add_field(**field) if ATTR_EMBED_FOOTER in embedding: