misc(aurora): removed ``` from all of the files that had it, replaced with redbot.core.utils.chat_formatting.box()
Some checks failed
Pylint / Pylint (3.11) (push) Failing after 54s
Some checks failed
Pylint / Pylint (3.11) (push) Failing after 54s
This commit is contained in:
parent
038c9413ce
commit
539052eb00
5 changed files with 17 additions and 13 deletions
|
@ -5,6 +5,7 @@ from datetime import datetime, timedelta
|
|||
|
||||
import humanize
|
||||
from discord import Color, Embed, Guild, Interaction, InteractionMessage, User, Member
|
||||
from redbot.core.utils.chat_formatting import box
|
||||
|
||||
from .config import config
|
||||
from .utils import fetch_channel_dict, fetch_user_dict, get_next_case_number
|
||||
|
@ -35,7 +36,6 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
|
|||
Required arguments for 'case', 'changes', and `evidenceformat`:
|
||||
- interaction
|
||||
- case_dict"""
|
||||
codeblock = '```'
|
||||
if embed_type == 'message':
|
||||
|
||||
if moderation_type in ["kicked", "banned", "tempbanned", "unbanned"]:
|
||||
|
@ -97,12 +97,12 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
|
|||
if case_dict['metadata']['imported_from']:
|
||||
embed.description += f"\n**Imported From:** {case_dict['metadata']['imported_from']}"
|
||||
|
||||
embed.add_field(name='Reason', value=f"{codeblock}{case_dict['reason']}{codeblock}", inline=False)
|
||||
embed.add_field(name='Reason', value=box(case_dict['reason']), inline=False)
|
||||
|
||||
if case_dict['resolved'] == 1:
|
||||
resolved_user = await fetch_user_dict(interaction, case_dict['resolved_by'])
|
||||
resolved_name = f"`{resolved_user['name']}`" if resolved_user['discriminator'] == "0" else f"`{resolved_user['name']}#{resolved_user['discriminator']}`"
|
||||
embed.add_field(name='Resolve Reason', value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n{codeblock}{case_dict['resolve_reason']}{codeblock}", inline=False)
|
||||
embed.add_field(name='Resolve Reason', value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n{box}{case_dict['resolve_reason']}", inline=False)
|
||||
|
||||
return embed
|
||||
|
||||
|
@ -147,16 +147,16 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
|
|||
moderator_user = await fetch_user_dict(interaction, case_dict['moderator_id'])
|
||||
moderator_name = moderator_user['name'] if moderator_user['discriminator'] == "0" else f"{moderator_user['name']}#{moderator_user['discriminator']}"
|
||||
|
||||
content = f"{codeblock}prolog\nCase: {case_dict['moderation_id']:,} ({str.title(case_dict['moderation_type'])})\nTarget: {target_name} ({target_user['id']})\nModerator: {moderator_name} ({moderator_user['id']})"
|
||||
content = f"Case: {case_dict['moderation_id']:,} ({str.title(case_dict['moderation_type'])})\nTarget: {target_name} ({target_user['id']})\nModerator: {moderator_name} ({moderator_user['id']})"
|
||||
|
||||
if case_dict['duration'] != 'NULL':
|
||||
hours, minutes, seconds = map(int, case_dict['duration'].split(':'))
|
||||
td = timedelta(hours=hours, minutes=minutes, seconds=seconds)
|
||||
content += f"\nDuration: {humanize.precisedelta(td)}"
|
||||
|
||||
content += f"\nReason: {case_dict['reason']}{codeblock}"
|
||||
content += f"\nReason: {case_dict['reason']}"
|
||||
|
||||
return content
|
||||
return box(content, 'prolog')
|
||||
|
||||
if embed_type == 'log':
|
||||
if resolved:
|
||||
|
@ -182,11 +182,11 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
|
|||
duration_embed = f"{humanize.precisedelta(td)} | <t:{case_dict['end_timestamp']}:R>" if case_dict["expired"] == '0' else str(humanize.precisedelta(td))
|
||||
embed.description = embed.description + f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}"
|
||||
|
||||
embed.add_field(name='Reason', value=f"{codeblock}{case_dict['reason']}{codeblock}", inline=False)
|
||||
embed.add_field(name='Reason', value=box(case_dict['reason']), inline=False)
|
||||
|
||||
resolved_user = await fetch_user_dict(interaction, case_dict['resolved_by'])
|
||||
resolved_name = resolved_user['name'] if resolved_user['discriminator'] == "0" else f"{resolved_user['name']}#{resolved_user['discriminator']}"
|
||||
embed.add_field(name='Resolve Reason', value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n{codeblock}{case_dict['resolve_reason']}{codeblock}", inline=False)
|
||||
embed.add_field(name='Resolve Reason', value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n" + box(case_dict['resolve_reason']), inline=False)
|
||||
else:
|
||||
if case_dict['target_type'] == 'USER':
|
||||
target_user = await fetch_user_dict(interaction, case_dict['target_id'])
|
||||
|
@ -208,7 +208,7 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
|
|||
td = timedelta(**{unit: int(val) for unit, val in zip(["hours", "minutes", "seconds"], case_dict["duration"].split(":"))})
|
||||
embed.description = embed.description + f"\n**Duration:** {humanize.precisedelta(td)} | <t:{case_dict['end_timestamp']}:R>"
|
||||
|
||||
embed.add_field(name='Reason', value=f"{codeblock}{case_dict['reason']}{codeblock}", inline=False)
|
||||
embed.add_field(name='Reason', value=box(case_dict['reason']), inline=False)
|
||||
return embed
|
||||
|
||||
raise(TypeError("'type' argument is invalid!"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue