Update modcase styling to include extra info
This commit is contained in:
parent
4965579897
commit
2630cf4c92
1 changed files with 14 additions and 10 deletions
|
@ -54,7 +54,8 @@ class CaseCog(Cog):
|
||||||
console = Console()
|
console = Console()
|
||||||
|
|
||||||
action_output = ""
|
action_output = ""
|
||||||
for action in mod_case.actions:
|
action_output_extra = ""
|
||||||
|
for idx, action in enumerate(mod_case.actions):
|
||||||
parent_action = await ACTIONS_LOOKUP[action.action_type].find_one(q(id=action.parent))
|
parent_action = await ACTIONS_LOOKUP[action.action_type].find_one(q(id=action.parent))
|
||||||
if not parent_action:
|
if not parent_action:
|
||||||
action.orphaned = True
|
action.orphaned = True
|
||||||
|
@ -69,13 +70,16 @@ class CaseCog(Cog):
|
||||||
console.print(action_table)
|
console.print(action_table)
|
||||||
|
|
||||||
tmp_output = cap.get()
|
tmp_output = cap.get()
|
||||||
if len(tmp_output) >= 1000:
|
if len(tmp_output) >= 800:
|
||||||
|
action_output_extra = f"... and {len(mod_case.actions[idx:])} more actions"
|
||||||
break
|
break
|
||||||
|
|
||||||
action_output = tmp_output
|
action_output = tmp_output
|
||||||
|
|
||||||
note_output = ""
|
note_output = ""
|
||||||
for note in sorted(mod_case.notes, key=lambda x: x.created_at):
|
note_output_extra = ""
|
||||||
|
notes = sorted(mod_case.notes, key=lambda x: x.created_at)
|
||||||
|
for idx, note in enumerate(notes):
|
||||||
admin = await self.bot.fetch_user(note.admin)
|
admin = await self.bot.fetch_user(note.admin)
|
||||||
admin_text = "N/A"
|
admin_text = "N/A"
|
||||||
if admin:
|
if admin:
|
||||||
|
@ -87,6 +91,7 @@ class CaseCog(Cog):
|
||||||
|
|
||||||
tmp_output = cap.get()
|
tmp_output = cap.get()
|
||||||
if len(tmp_output) >= 1000:
|
if len(tmp_output) >= 1000:
|
||||||
|
note_output_extra = f"... and {len(notes[idx:])} more notes"
|
||||||
break
|
break
|
||||||
|
|
||||||
note_output = tmp_output
|
note_output = tmp_output
|
||||||
|
@ -105,20 +110,19 @@ class CaseCog(Cog):
|
||||||
if admin:
|
if admin:
|
||||||
admin_text = admin.mention
|
admin_text = admin.mention
|
||||||
|
|
||||||
ts = int(mod_case.created_at.timestamp())
|
action_output = f"```ansi\n{action_output}\n{action_output_extra}\n```"
|
||||||
|
note_output = f"```ansi\n{note_output}\n{note_output_extra}\n```"
|
||||||
action_output = f"```ansi\n{action_output}\n```"
|
|
||||||
note_output = f"```ansi\n{note_output}\n```"
|
|
||||||
|
|
||||||
fields = (
|
fields = (
|
||||||
EmbedField(name="Opened By", value=admin_text),
|
|
||||||
EmbedField(name="Opened At", value=f"<t:{ts}:F>"),
|
|
||||||
EmbedField(name="Actions", value=action_output),
|
EmbedField(name="Actions", value=action_output),
|
||||||
EmbedField(name="Notes", value=note_output),
|
EmbedField(name="Notes", value=note_output),
|
||||||
)
|
)
|
||||||
|
|
||||||
embed = build_embed(
|
embed = build_embed(
|
||||||
title="Moderation Case", description=f"{status} case against {user_text}", fields=fields
|
title=f"Moderation Case [{mod_case.id}]",
|
||||||
|
description=f"{status} case against {user_text} opened by {admin_text}",
|
||||||
|
fields=fields,
|
||||||
|
timestamp=mod_case.created_at,
|
||||||
)
|
)
|
||||||
icon_url = None
|
icon_url = None
|
||||||
if user:
|
if user:
|
||||||
|
|
Loading…
Add table
Reference in a new issue