Change embed color to str and set a default one
This commit is contained in:
@ -12,7 +12,7 @@ from discord_rss_bot.settings import get_reader
|
||||
class CustomEmbed:
|
||||
title: str
|
||||
description: str
|
||||
color: int
|
||||
color: str
|
||||
author_name: str
|
||||
author_url: str
|
||||
author_icon_url: str
|
||||
@ -290,7 +290,7 @@ def get_embed(custom_reader: Reader, feed: Feed) -> CustomEmbed:
|
||||
return CustomEmbed(
|
||||
title="",
|
||||
description="",
|
||||
color=32896,
|
||||
color="#469ad9",
|
||||
author_name="",
|
||||
author_url="",
|
||||
author_icon_url="",
|
||||
@ -312,7 +312,7 @@ def get_embed_data(embed_data) -> CustomEmbed:
|
||||
"""
|
||||
title: str = embed_data.get("title", "")
|
||||
description: str = embed_data.get("description", "")
|
||||
color: int = embed_data.get("color", 32896)
|
||||
color: str = embed_data.get("color", "")
|
||||
author_name: str = embed_data.get("author_name", "")
|
||||
author_url: str = embed_data.get("author_url", "")
|
||||
author_icon_url: str = embed_data.get("author_icon_url", "")
|
||||
|
@ -69,10 +69,6 @@ def create_embed_webhook(webhook_url: str, entry: Entry) -> DiscordWebhook:
|
||||
|
||||
discord_embed: DiscordEmbed = DiscordEmbed()
|
||||
|
||||
# Remove # from the color if it exists.
|
||||
if type(custom_embed.color) is str and custom_embed.color.startswith("#"):
|
||||
custom_embed.color = custom_embed.color[1:]
|
||||
|
||||
if custom_embed.title:
|
||||
discord_embed.set_title(custom_embed.title)
|
||||
if custom_embed.description:
|
||||
|
@ -13,6 +13,7 @@ default_custom_embed: dict[str, str] = {
|
||||
"title": "{{entry_title}}",
|
||||
"description": "{{entry_text}}",
|
||||
"image_url": "{{image_1}}",
|
||||
"color": "#469ad9",
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user