1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 20:23:12 +00:00

Force set a theme on each embed creation

This commit is contained in:
wlinator 2024-08-29 09:46:20 -04:00
parent 3a336aed19
commit 07257bc2bb

View file

@ -9,9 +9,9 @@ from lib.const import CONST
class Builder: class Builder:
@staticmethod @staticmethod
def create_embed( def create_embed(
theme: Literal["error", "success", "info", "warning", "default"],
user_name: str | None = None, user_name: str | None = None,
user_display_avatar_url: str | None = None, user_display_avatar_url: str | None = None,
theme: Literal["error", "success", "info", "warning"] | None = None,
title: str | None = None, title: str | None = None,
author_text: str | None = None, author_text: str | None = None,
author_icon_url: str | None = None, author_icon_url: str | None = None,
@ -35,9 +35,9 @@ class Builder:
"success": (CONST.COLOR_DEFAULT, CONST.CHECK_ICON), "success": (CONST.COLOR_DEFAULT, CONST.CHECK_ICON),
"info": (CONST.COLOR_DEFAULT, CONST.INFO_ICON), "info": (CONST.COLOR_DEFAULT, CONST.INFO_ICON),
"warning": (CONST.COLOR_WARNING, CONST.WARNING_ICON), "warning": (CONST.COLOR_WARNING, CONST.WARNING_ICON),
"default": (color or CONST.COLOR_DEFAULT, None),
} }
if theme in theme_settings: color, author_icon_url = theme_settings[theme]
color, author_icon_url = theme_settings[theme]
if user_name and not hide_name_in_description: if user_name and not hide_name_in_description:
description = f"**{user_name}** {description}" description = f"**{user_name}** {description}"
@ -45,7 +45,7 @@ class Builder:
embed: discord.Embed = discord.Embed( embed: discord.Embed = discord.Embed(
title=title, title=title,
description=description, description=description,
color=color or CONST.COLOR_DEFAULT, color=color,
) )
embed.set_author( embed.set_author(