diff --git a/lib/help.py b/lib/help.py index b7972cc..5bc6dc4 100644 --- a/lib/help.py +++ b/lib/help.py @@ -49,7 +49,7 @@ class LuminaraHelp(commands.HelpCommand): The created embed. """ return Builder.create_embed( - theme="info", + Builder.INFO, author_text=author, description=description, footer_text=CONST.STRINGS["help_footer"], @@ -185,7 +185,7 @@ class LuminaraHelp(commands.HelpCommand): The error message to be sent. """ embed = Builder.create_embed( - theme="error", + Builder.ERROR, title="Error in help command", description=error, ) diff --git a/modules/admin/admin.py b/modules/admin/admin.py index 67a4dd9..302f403 100644 --- a/modules/admin/admin.py +++ b/modules/admin/admin.py @@ -39,7 +39,7 @@ class Sql(commands.Cog): try: results = database.select_query(f"SELECT {query}") embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["admin_sql_select_title"], description=CONST.STRINGS["admin_sql_select_description"].format( @@ -50,7 +50,7 @@ class Sql(commands.Cog): ) except mysql.connector.Error as error: embed = Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["admin_sql_select_error_title"], description=CONST.STRINGS["admin_sql_select_error_description"].format( @@ -83,7 +83,7 @@ class Sql(commands.Cog): try: database.execute_query(query) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["admin_sql_inject_title"], description=CONST.STRINGS["admin_sql_inject_description"].format( @@ -93,7 +93,7 @@ class Sql(commands.Cog): ) except mysql.connector.Error as error: embed = Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["admin_sql_inject_error_title"], description=CONST.STRINGS["admin_sql_inject_error_description"].format( diff --git a/modules/admin/award.py b/modules/admin/award.py index 884f741..04fb547 100644 --- a/modules/admin/award.py +++ b/modules/admin/award.py @@ -38,7 +38,7 @@ class Award(commands.Cog): curr.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["admin_award_title"], description=CONST.STRINGS["admin_award_description"].format( diff --git a/modules/admin/blacklist.py b/modules/admin/blacklist.py index e3a40ff..dbae4a4 100644 --- a/modules/admin/blacklist.py +++ b/modules/admin/blacklist.py @@ -37,7 +37,7 @@ class Blacklist(commands.Cog): blacklist_service.add_to_blacklist(reason) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["admin_blacklist_author"], description=CONST.STRINGS["admin_blacklist_description"].format(user.name), diff --git a/modules/birthdays/birthday.py b/modules/birthdays/birthday.py index e61782e..ab0d054 100644 --- a/modules/birthdays/birthday.py +++ b/modules/birthdays/birthday.py @@ -46,7 +46,7 @@ class Birthday(commands.GroupCog, group_name="birthday"): message = random.choice(CONST.BIRTHDAY_MESSAGES) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, author_text="Happy Birthday!", description=message.format(member.name), hide_name_in_description=True, @@ -118,7 +118,7 @@ class Birthday(commands.GroupCog, group_name="birthday"): birthday.set(date_obj) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["birthday_add_success_author"], description=CONST.STRINGS["birthday_add_success_description"].format( @@ -146,7 +146,7 @@ class Birthday(commands.GroupCog, group_name="birthday"): BirthdayService(interaction.user.id, interaction.guild.id).delete() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["birthday_delete_success_author"], description=CONST.STRINGS["birthday_delete_success_description"], @@ -173,7 +173,7 @@ class Birthday(commands.GroupCog, group_name="birthday"): if not upcoming_birthdays: embed = Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=interaction.user.name, author_text=CONST.STRINGS["birthday_upcoming_no_birthdays_author"], description=CONST.STRINGS["birthday_upcoming_no_birthdays"], @@ -182,7 +182,7 @@ class Birthday(commands.GroupCog, group_name="birthday"): return embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["birthday_upcoming_author"], description="", diff --git a/modules/config/config.py b/modules/config/config.py index f8fc092..d565719 100644 --- a/modules/config/config.py +++ b/modules/config/config.py @@ -41,7 +41,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config: GuildConfig = GuildConfig(interaction.guild.id) guild: discord.Guild = interaction.guild embed: discord.Embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_show_author"].format(guild.name), thumbnail_url=guild.icon.url if guild.icon else CONST.LUMI_LOGO_TRANSPARENT, @@ -117,7 +117,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_birthday_channel_set"].format( @@ -142,7 +142,7 @@ class Config(commands.GroupCog, group_name="config"): if not guild_config.birthday_channel_id: embed = Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_birthday_module_already_disabled"], @@ -150,7 +150,7 @@ class Config(commands.GroupCog, group_name="config"): else: embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_birthday_module_disabled"], @@ -178,7 +178,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_level_channel_set"].format(channel.mention), @@ -207,7 +207,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_boost_channel_set"].format(channel.mention), @@ -230,7 +230,7 @@ class Config(commands.GroupCog, group_name="config"): if not guild_config.boost_channel_id: embed = Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_boost_module_already_disabled"], @@ -240,7 +240,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.boost_message = None guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_boost_module_disabled"], @@ -266,7 +266,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_boost_template_updated"], @@ -317,7 +317,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_boost_image_updated"], @@ -358,7 +358,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed: discord.Embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_welcome_channel_set"].format(channel.mention), @@ -381,7 +381,7 @@ class Config(commands.GroupCog, group_name="config"): if not guild_config.welcome_channel_id: embed: discord.Embed = Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_welcome_module_already_disabled"], @@ -391,7 +391,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.welcome_message = None guild_config.push() embed: discord.Embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_welcome_module_disabled"], @@ -417,7 +417,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed: discord.Embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_welcome_template_updated"], @@ -456,7 +456,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_level_current_channel_set"], @@ -483,7 +483,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_level_module_disabled"], @@ -506,7 +506,7 @@ class Config(commands.GroupCog, group_name="config"): if guild_config.level_message_type != 0: embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_level_module_already_enabled"], @@ -515,7 +515,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config.level_message_type = 1 guild_config.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_level_module_enabled"], @@ -543,7 +543,7 @@ class Config(commands.GroupCog, group_name="config"): preview = lib.format.template(text, "Lucas", 15) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_level_template_updated"], @@ -580,7 +580,7 @@ class Config(commands.GroupCog, group_name="config"): guild_config = GuildConfig(interaction.guild.id) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], ) @@ -625,7 +625,7 @@ class Config(commands.GroupCog, group_name="config"): mod_log = ModLogService() info_embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=interaction.user.name, author_text=CONST.STRINGS["config_modlog_info_author"], description=CONST.STRINGS["config_modlog_info_description"].format( @@ -652,7 +652,7 @@ class Config(commands.GroupCog, group_name="config"): mod_log.set_modlog_channel(interaction.guild.id, channel.id) success_embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_modlog_channel_set"].format(channel.mention), @@ -675,7 +675,7 @@ class Config(commands.GroupCog, group_name="config"): assert interaction.guild if len(prefix) > 25: embed = Builder.create_embed( - theme="error", + Builder.ERROR, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_prefix_too_long"], @@ -687,7 +687,7 @@ class Config(commands.GroupCog, group_name="config"): GuildConfig.set_prefix(guild_config.guild_id, prefix) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_prefix_set"].format(prefix), @@ -709,7 +709,7 @@ class Config(commands.GroupCog, group_name="config"): level_reward = XpRewardService(interaction.guild.id) embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=interaction.user.name, author_text="Level Rewards", thumbnail_url=interaction.guild.icon.url if interaction.guild.icon else CONST.LUMI_LOGO_OPAQUE, @@ -760,7 +760,7 @@ class Config(commands.GroupCog, group_name="config"): level_reward.add_reward(level, role.id, persistent) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_xpreward_added"].format(level, role.mention), @@ -785,7 +785,7 @@ class Config(commands.GroupCog, group_name="config"): level_reward.remove_reward(level) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["config_author"], description=CONST.STRINGS["config_xpreward_removed"].format(level), diff --git a/modules/economy/balance.py b/modules/economy/balance.py index 33ce4a9..bef074d 100644 --- a/modules/economy/balance.py +++ b/modules/economy/balance.py @@ -34,7 +34,7 @@ class Balance(commands.Cog): balance = Currency.format(ctx_currency.balance) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["balance_author"].format(ctx.author.name), author_icon_url=ctx.author.display_avatar.url, diff --git a/modules/economy/blackjack.py b/modules/economy/blackjack.py index 16cf299..fa4bcfd 100644 --- a/modules/economy/blackjack.py +++ b/modules/economy/blackjack.py @@ -199,7 +199,7 @@ class Blackjack(commands.Cog): ) return Builder.create_embed( - theme="default", + Builder.DEFAULT, user_name=ctx.author.name, title=CONST.STRINGS["blackjack_title"], description=description, @@ -218,7 +218,7 @@ class Blackjack(commands.Cog): status: int, ) -> discord.Embed: embed = Builder.create_embed( - theme="default", + Builder.DEFAULT, user_name=ctx.author.name, title=CONST.STRINGS["blackjack_title"], description=CONST.STRINGS["blackjack_description"].format( diff --git a/modules/economy/daily.py b/modules/economy/daily.py index e5feb49..748b5b5 100644 --- a/modules/economy/daily.py +++ b/modules/economy/daily.py @@ -52,7 +52,7 @@ class Daily(commands.Cog): wait_time: datetime = datetime.now(tz) + timedelta(seconds=seconds_until(7, 0)) unix_time: int = int(round(wait_time.timestamp())) error_embed: Embed = Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["daily_already_claimed_author"], description=CONST.STRINGS["daily_already_claimed_description"].format( @@ -70,7 +70,7 @@ class Daily(commands.Cog): ctx_daily.refresh() embed: Embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["daily_success_claim_author"], description=CONST.STRINGS["daily_success_claim_description"].format( diff --git a/modules/economy/give.py b/modules/economy/give.py index d91e3bf..4eeff96 100644 --- a/modules/economy/give.py +++ b/modules/economy/give.py @@ -56,7 +56,7 @@ class Give(commands.Cog): target_currency.push() embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, description=CONST.STRINGS["give_success"].format( Currency.format(amount), diff --git a/modules/levels/leaderboard.py b/modules/levels/leaderboard.py index efa0fbd..c34a87b 100644 --- a/modules/levels/leaderboard.py +++ b/modules/levels/leaderboard.py @@ -37,7 +37,7 @@ class Leaderboard(commands.Cog): author: Member = cast(Member, ctx.author) embed: Embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=author.name, thumbnail_url=author.display_avatar.url, hide_name_in_description=True, diff --git a/modules/levels/level.py b/modules/levels/level.py index 4c269eb..9ce19d6 100644 --- a/modules/levels/level.py +++ b/modules/levels/level.py @@ -37,7 +37,7 @@ class Level(commands.Cog): ) embed: Embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, title=CONST.STRINGS["xp_level"].format(xp_data.level), footer_text=CONST.STRINGS["xp_server_rank"].format(rank or "NaN"), diff --git a/modules/misc/info.py b/modules/misc/info.py index 3aa4539..a201417 100644 --- a/modules/misc/info.py +++ b/modules/misc/info.py @@ -34,7 +34,7 @@ class Info(commands.Cog): ) embed: discord.Embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=f"{CONST.TITLE} v{CONST.VERSION}", author_url=CONST.REPO_URL, diff --git a/modules/misc/introduction.py b/modules/misc/introduction.py index 583e2bb..a0b1d8c 100644 --- a/modules/misc/introduction.py +++ b/modules/misc/introduction.py @@ -34,7 +34,7 @@ class Introduction(commands.Cog): if not guild or not member: await ctx.send( embed=Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["intro_no_guild_author"], description=CONST.STRINGS["intro_no_guild"], @@ -54,7 +54,7 @@ class Introduction(commands.Cog): ): await ctx.send( embed=Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["intro_no_channel_author"], description=CONST.STRINGS["intro_no_channel"], @@ -66,7 +66,7 @@ class Introduction(commands.Cog): view: IntroductionStartButtons | IntroductionFinishButtons = IntroductionStartButtons(ctx) await ctx.send( embed=Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=CONST.STRINGS["intro_service_name"], description=CONST.STRINGS["intro_start"].format(channel.mention), @@ -80,7 +80,7 @@ class Introduction(commands.Cog): if view.clicked_stop: await ctx.send( embed=Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["intro_stopped_author"], description=CONST.STRINGS["intro_stopped"], @@ -102,7 +102,7 @@ class Introduction(commands.Cog): for key, question in question_mapping.items(): await ctx.send( embed=Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=key, description=question, @@ -121,7 +121,7 @@ class Introduction(commands.Cog): if len(answer_content) > 200: await ctx.send( embed=Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["intro_too_long_author"], description=CONST.STRINGS["intro_too_long"], @@ -135,7 +135,7 @@ class Introduction(commands.Cog): except TimeoutError: await ctx.send( embed=Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["intro_timeout_author"], description=CONST.STRINGS["intro_timeout"], @@ -149,7 +149,7 @@ class Introduction(commands.Cog): ) preview: discord.Embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=ctx.author.name, author_icon_url=ctx.author.display_avatar.url, @@ -169,7 +169,7 @@ class Introduction(commands.Cog): ) await ctx.send( embed=Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=CONST.STRINGS["intro_post_confirmation_author"], description=CONST.STRINGS["intro_post_confirmation"].format( @@ -180,7 +180,7 @@ class Introduction(commands.Cog): else: await ctx.send( embed=Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["intro_stopped_author"], description=CONST.STRINGS["intro_stopped"], diff --git a/modules/misc/invite.py b/modules/misc/invite.py index 5556bf1..a583a25 100644 --- a/modules/misc/invite.py +++ b/modules/misc/invite.py @@ -24,7 +24,7 @@ class Invite(commands.Cog): """ await ctx.send( embed=Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["invite_author"], description=CONST.STRINGS["invite_description"], diff --git a/modules/misc/ping.py b/modules/misc/ping.py index bcca38b..8d9166d 100644 --- a/modules/misc/ping.py +++ b/modules/misc/ping.py @@ -22,7 +22,7 @@ class Ping(commands.Cog): The context of the command. """ embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["ping_author"], description=CONST.STRINGS["ping_pong"], diff --git a/modules/misc/uptime.py b/modules/misc/uptime.py index 400ee81..4ca5b1f 100644 --- a/modules/misc/uptime.py +++ b/modules/misc/uptime.py @@ -29,7 +29,7 @@ class Uptime(commands.Cog): unix_timestamp: int = int(self.start_time.timestamp()) embed: Embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=CONST.STRINGS["ping_author"], description=CONST.STRINGS["ping_uptime"].format(unix_timestamp), diff --git a/modules/misc/xkcd.py b/modules/misc/xkcd.py index 9d4eecc..10f567c 100644 --- a/modules/misc/xkcd.py +++ b/modules/misc/xkcd.py @@ -25,7 +25,7 @@ async def print_comic( await interaction.response.send_message( embed=Builder.create_embed( - theme="info", + Builder.INFO, author_text=CONST.STRINGS["xkcd_title"].format(comic.id, comic.title), description=CONST.STRINGS["xkcd_description"].format( comic.explanation_url, @@ -39,7 +39,7 @@ async def print_comic( except HttpError: await interaction.response.send_message( embed=Builder.create_embed( - theme="error", + Builder.ERROR, author_text=CONST.STRINGS["xkcd_not_found_author"], description=CONST.STRINGS["xkcd_not_found"], footer_text=CONST.STRINGS["xkcd_footer"], diff --git a/modules/moderation/ban.py b/modules/moderation/ban.py index f116a29..b5c141d 100644 --- a/modules/moderation/ban.py +++ b/modules/moderation/ban.py @@ -58,7 +58,7 @@ class Ban(commands.Cog): with contextlib.suppress(discord.HTTPException, discord.Forbidden): await target.send( embed=Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=target.name, author_text=CONST.STRINGS["mod_banned_author"], description=CONST.STRINGS["mod_ban_dm"].format( @@ -74,7 +74,7 @@ class Ban(commands.Cog): await ctx.guild.ban(target, reason=formatted_reason) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["mod_banned_author"], description=CONST.STRINGS["mod_banned_user"].format(target.name), @@ -126,7 +126,7 @@ class Ban(commands.Cog): respond_task = ctx.send( embed=Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["mod_unbanned_author"], description=CONST.STRINGS["mod_unbanned"].format(target.name), @@ -138,7 +138,7 @@ class Ban(commands.Cog): except (discord.NotFound, discord.HTTPException): await ctx.send( embed=Builder.create_embed( - theme="error", + Builder.ERROR, user_name=ctx.author.name, author_text=CONST.STRINGS["mod_not_banned_author"], description=CONST.STRINGS["mod_not_banned"].format(target.id), diff --git a/modules/moderation/cases.py b/modules/moderation/cases.py index 738ca16..e45860f 100644 --- a/modules/moderation/cases.py +++ b/modules/moderation/cases.py @@ -22,7 +22,7 @@ case_service = CaseService() def create_no_cases_embed(ctx: commands.Context[Luminara], author_text: str, description: str) -> discord.Embed: return Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=author_text, description=description, @@ -216,7 +216,7 @@ class Cases(commands.Cog): ) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["case_reason_update_author"], description=CONST.STRINGS["case_reason_update_description"].format( diff --git a/modules/moderation/kick.py b/modules/moderation/kick.py index 471854e..ff392b0 100644 --- a/modules/moderation/kick.py +++ b/modules/moderation/kick.py @@ -50,7 +50,7 @@ class Kick(commands.Cog): try: await target.send( embed=Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=target.name, author_text=CONST.STRINGS["mod_kicked_author"], description=CONST.STRINGS["mod_kick_dm"].format( @@ -75,7 +75,7 @@ class Kick(commands.Cog): respond_task = ctx.send( embed=Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["mod_kicked_author"], description=CONST.STRINGS["mod_kicked_user"].format(target.name), diff --git a/modules/moderation/softban.py b/modules/moderation/softban.py index ab1c915..a32b9c7 100644 --- a/modules/moderation/softban.py +++ b/modules/moderation/softban.py @@ -50,7 +50,7 @@ class Softban(commands.Cog): try: await target.send( embed=Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=target.name, author_text=CONST.STRINGS["mod_softbanned_author"], description=CONST.STRINGS["mod_softban_dm"].format( @@ -83,7 +83,7 @@ class Softban(commands.Cog): respond_task = ctx.send( embed=Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=target.name, author_text=CONST.STRINGS["mod_softbanned_author"], description=CONST.STRINGS["mod_softbanned_user"].format(target.name), diff --git a/modules/moderation/timeout.py b/modules/moderation/timeout.py index e34b6ca..1fb0a5a 100644 --- a/modules/moderation/timeout.py +++ b/modules/moderation/timeout.py @@ -70,7 +70,7 @@ class Timeout(commands.Cog): dm_task = target.send( embed=Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=target.name, author_text=CONST.STRINGS["mod_timed_out_author"], description=CONST.STRINGS["mod_timeout_dm"].format( @@ -85,7 +85,7 @@ class Timeout(commands.Cog): respond_task = ctx.send( embed=Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=target.name, author_text=CONST.STRINGS["mod_timed_out_author"], description=CONST.STRINGS["mod_timed_out_user"].format(target.name), @@ -138,7 +138,7 @@ class Timeout(commands.Cog): respond_task = ctx.send( embed=Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["mod_untimed_out_author"], description=CONST.STRINGS["mod_untimed_out"].format(target.name), @@ -152,7 +152,7 @@ class Timeout(commands.Cog): except discord.HTTPException: await ctx.send( embed=Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=ctx.author.name, author_text=CONST.STRINGS["mod_not_timed_out_author"], description=CONST.STRINGS["mod_not_timed_out"].format(target.name), diff --git a/modules/moderation/warn.py b/modules/moderation/warn.py index bfc85dc..94424a4 100644 --- a/modules/moderation/warn.py +++ b/modules/moderation/warn.py @@ -48,7 +48,7 @@ class Warn(commands.Cog): dm_task = target.send( embed=Builder.create_embed( - theme="info", + Builder.INFO, user_name=target.name, author_text=CONST.STRINGS["mod_warned_author"], description=CONST.STRINGS["mod_warn_dm"].format( @@ -62,7 +62,7 @@ class Warn(commands.Cog): respond_task = ctx.send( embed=Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=ctx.author.name, author_text=CONST.STRINGS["mod_warned_author"], description=CONST.STRINGS["mod_warned_user"].format(target.name), diff --git a/modules/triggers/triggers.py b/modules/triggers/triggers.py index 240e469..2bf2abf 100644 --- a/modules/triggers/triggers.py +++ b/modules/triggers/triggers.py @@ -77,7 +77,7 @@ class Triggers(commands.GroupCog, group_name="trigger"): raise LumiException(CONST.STRINGS["triggers_not_added"]) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["triggers_add_author"], description="", @@ -141,7 +141,7 @@ class Triggers(commands.GroupCog, group_name="trigger"): raise LumiException(CONST.STRINGS["triggers_not_added"]) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["triggers_add_author"], description="", @@ -184,7 +184,7 @@ class Triggers(commands.GroupCog, group_name="trigger"): await reaction_service.delete_custom_reaction(reaction_id) embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, author_text=CONST.STRINGS["triggers_delete_author"], description=CONST.STRINGS["triggers_delete_description"], @@ -210,7 +210,7 @@ class Triggers(commands.GroupCog, group_name="trigger"): reactions: list[dict[str, Any]] = await reaction_service.find_all_by_guild(guild_id) if not reactions: embed: discord.Embed = Builder.create_embed( - theme="warning", + Builder.WARNING, user_name=interaction.user.name, author_text=CONST.STRINGS["triggers_no_reactions_title"], description=CONST.STRINGS["triggers_no_reactions_description"], @@ -224,7 +224,7 @@ class Triggers(commands.GroupCog, group_name="trigger"): for reaction in reactions: embed: discord.Embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, title=CONST.STRINGS["triggers_list_custom_reaction_id"].format( reaction["id"], diff --git a/ui/cases.py b/ui/cases.py index 1481d35..7c7c65d 100644 --- a/ui/cases.py +++ b/ui/cases.py @@ -20,7 +20,7 @@ def create_case_embed( duration: int | None = None, ) -> discord.Embed: embed: discord.Embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=CONST.STRINGS["case_new_case_author"], thumbnail_url=target.display_avatar.url, @@ -82,7 +82,7 @@ def create_case_list_embed( author_text: str, ) -> discord.Embed: embed: discord.Embed = Builder.create_embed( - theme="info", + Builder.INFO, user_name=ctx.author.name, author_text=author_text, hide_name_in_description=True, diff --git a/ui/embeds.py b/ui/embeds.py index 4fcf49a..2a16bed 100644 --- a/ui/embeds.py +++ b/ui/embeds.py @@ -1,15 +1,29 @@ from datetime import datetime -from typing import Literal +from enum import Enum import discord from lib.const import CONST +class Theme(Enum): + ERROR = 1 + SUCCESS = 2 + INFO = 3 + WARNING = 4 + DEFAULT = 5 + + class Builder: + ERROR = Theme.ERROR + SUCCESS = Theme.SUCCESS + INFO = Theme.INFO + WARNING = Theme.WARNING + DEFAULT = Theme.DEFAULT + @staticmethod def create_embed( - theme: Literal["error", "success", "info", "warning", "default"], + theme: Theme, user_name: str | None = None, user_display_avatar_url: str | None = None, title: str | None = None, @@ -29,38 +43,34 @@ class Builder: """ Create a standard Lumi embed with the given parameters. """ - theme_settings = { - "error": (CONST.COLOR_ERROR, CONST.CROSS_ICON), - "success": (CONST.COLOR_DEFAULT, CONST.CHECK_ICON), - "info": (CONST.COLOR_DEFAULT, CONST.INFO_ICON), - "warning": (CONST.COLOR_WARNING, CONST.WARNING_ICON), - "default": (color or CONST.COLOR_DEFAULT, None), + Theme.ERROR: (CONST.COLOR_ERROR, CONST.CROSS_ICON), + Theme.SUCCESS: (CONST.COLOR_DEFAULT, CONST.CHECK_ICON), + Theme.INFO: (CONST.COLOR_DEFAULT, CONST.INFO_ICON), + Theme.WARNING: (CONST.COLOR_WARNING, CONST.WARNING_ICON), + Theme.DEFAULT: (color or CONST.COLOR_DEFAULT, None), } - color, author_icon_url = theme_settings[theme] + embed_color, theme_icon = theme_settings[theme] if user_name and not hide_name_in_description: - description = f"**{user_name}** {description}" + description = f"**{user_name}** {description or ''}" - embed: discord.Embed = discord.Embed( + embed = discord.Embed( title=title, description=description, - color=color, + color=embed_color, + timestamp=None if hide_time else (timestamp or discord.utils.utcnow()), ) embed.set_author( - name=author_text or user_name or None, - icon_url=author_icon_url or user_display_avatar_url or None, + name=author_text or user_name, + icon_url=author_icon_url or theme_icon or user_display_avatar_url, url=author_url, ) - embed.set_footer( - text=footer_text or CONST.TITLE, - icon_url=footer_icon_url or CONST.LUMI_LOGO_TRANSPARENT, - ) + embed.set_footer(text=footer_text or CONST.TITLE, icon_url=footer_icon_url or CONST.LUMI_LOGO_TRANSPARENT) - embed.timestamp = None if hide_time else (timestamp or discord.utils.utcnow()) if image_url: embed.set_image(url=image_url) if thumbnail_url: diff --git a/ui/views/leaderboard.py b/ui/views/leaderboard.py index 277e4e2..2d3acc3 100644 --- a/ui/views/leaderboard.py +++ b/ui/views/leaderboard.py @@ -78,7 +78,7 @@ class LeaderboardCommandView(discord.ui.View): async def interaction_check(self, interaction: discord.Interaction) -> bool: if interaction.user and interaction.user != self.ctx.author: embed = Builder.create_embed( - theme="error", + Builder.ERROR, user_name=interaction.user.name, description=CONST.STRINGS["xp_lb_cant_use_dropdown"], hide_name_in_description=True, @@ -92,7 +92,7 @@ class LeaderboardCommandView(discord.ui.View): return embed = Builder.create_embed( - theme="success", + Builder.SUCCESS, user_name=interaction.user.name, thumbnail_url=CONST.FLOWERS_ART, hide_name_in_description=True,