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

refactor: Update case creation embed fields with dynamic values

This commit is contained in:
wlinator 2024-07-18 16:32:07 -04:00
parent 5b016f9142
commit 17b4816fe9
2 changed files with 24 additions and 4 deletions

View file

@ -11,6 +11,12 @@
"case_moderator_field_value": "`{0}`",
"case_target_field_value": "`{0}` 🎯",
"case_reason_field_value": "`{0}`",
"case_guild_no_cases_author": "No Mod Cases",
"case_guild_no_cases": "this server doesn't have any mod cases yet.",
"case_mod_no_cases_author": "No Mod Cases",
"case_mod_no_cases": "this user has not handled any cases in this server.",
"case_guild_cases_author": "All Cases in this Server",
"case_mod_cases_author": "Cases by Moderator ({0})",
"daily_already_claimed_author": "Already Claimed",
"daily_already_claimed_description": "you can claim your daily reward again <t:{0}:R>.",
"daily_already_claimed_footer": "Daily reset is at 7 AM EST",

View file

@ -38,12 +38,21 @@ async def view_all_cases_in_guild(ctx, guild_id: int):
cases = case_service.fetch_cases_by_guild(guild_id)
if not cases:
return await ctx.respond("This server doesn't have any mod cases yet.")
embed = EmbedBuilder.create_error_embed(
ctx,
author_text=CONST.STRINGS["case_guild_no_cases_author"],
description=CONST.STRINGS["case_guild_no_cases"],
)
return await ctx.respond(embed=embed)
pages_list = []
for i in range(0, len(cases), 10):
chunk = cases[i : i + 10]
embed = create_case_list_embed(ctx, chunk, "All Cases in this Server")
embed = create_case_list_embed(
ctx,
chunk,
CONST.STRINGS["case_guild_cases_author"],
)
pages_list.append(embed)
paginator = pages.Paginator(pages=pages_list)
@ -54,7 +63,12 @@ async def view_all_cases_by_mod(ctx, guild_id: int, moderator: discord.User):
cases = case_service.fetch_cases_by_moderator(guild_id, moderator.id)
if not cases:
return await ctx.respond("This user has not handled any cases in this server.")
embed = EmbedBuilder.create_error_embed(
ctx,
author_text=CONST.STRINGS["case_mod_no_cases_author"],
description=CONST.STRINGS["case_mod_no_cases"],
)
return await ctx.respond(embed=embed)
pages_list = []
for i in range(0, len(cases), 10):
@ -62,7 +76,7 @@ async def view_all_cases_by_mod(ctx, guild_id: int, moderator: discord.User):
embed = create_case_list_embed(
ctx,
chunk,
f"Cases by Moderator ({moderator.name})",
CONST.STRINGS["case_mod_cases_author"].format(moderator.name),
)
pages_list.append(embed)