style(aurora): reformat with ruff
This commit is contained in:
parent
ab22b791d1
commit
df22f73d2e
8 changed files with 64 additions and 102 deletions
|
@ -17,13 +17,9 @@ class ImportAuroraView(ui.View):
|
|||
self.message: Message = message
|
||||
|
||||
@ui.button(label="Yes", style=ButtonStyle.success)
|
||||
async def import_button_y(
|
||||
self, interaction: Interaction, button: ui.Button
|
||||
): # pylint: disable=unused-argument
|
||||
async def import_button_y(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
await self.message.delete()
|
||||
await interaction.response.send_message(
|
||||
"Deleting original table...", ephemeral=True
|
||||
)
|
||||
await interaction.response.send_message("Deleting original table...", ephemeral=True)
|
||||
|
||||
database = connect()
|
||||
cursor = database.cursor()
|
||||
|
@ -101,16 +97,10 @@ class ImportAuroraView(ui.View):
|
|||
|
||||
await interaction.edit_original_response(content="Import complete.")
|
||||
if failed_cases:
|
||||
await interaction.edit_original_response(
|
||||
content="Import complete.\n"
|
||||
+ warning("Failed to import the following cases:\n")
|
||||
+ box(failed_cases)
|
||||
)
|
||||
await interaction.edit_original_response(content="Import complete.\n" + warning("Failed to import the following cases:\n") + box(failed_cases))
|
||||
|
||||
@ui.button(label="No", style=ButtonStyle.danger)
|
||||
async def import_button_n(
|
||||
self, interaction: Interaction, button: ui.Button
|
||||
): # pylint: disable=unused-argument
|
||||
async def import_button_n(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
await self.message.edit(content="Import cancelled.", view=None)
|
||||
await self.message.delete(10)
|
||||
await self.ctx.message.delete(10)
|
||||
|
|
|
@ -16,13 +16,9 @@ class ImportGalacticBotView(ui.View):
|
|||
self.message: Message = message
|
||||
|
||||
@ui.button(label="Yes", style=ButtonStyle.success)
|
||||
async def import_button_y(
|
||||
self, interaction: Interaction, button: ui.Button
|
||||
): # pylint: disable=unused-argument
|
||||
async def import_button_y(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
await self.message.delete()
|
||||
await interaction.response.send_message(
|
||||
"Deleting original table...", ephemeral=True
|
||||
)
|
||||
await interaction.response.send_message("Deleting original table...", ephemeral=True)
|
||||
|
||||
database = connect()
|
||||
cursor = database.cursor()
|
||||
|
@ -92,9 +88,7 @@ class ImportGalacticBotView(ui.View):
|
|||
if resolved_by is None:
|
||||
resolved_by = "?"
|
||||
if resolved_reason is None:
|
||||
resolved_reason = (
|
||||
"Could not get resolve reason during moderation import."
|
||||
)
|
||||
resolved_reason = "Could not get resolve reason during moderation import."
|
||||
if resolved_timestamp is None:
|
||||
resolved_timestamp = timestamp
|
||||
changes = [
|
||||
|
@ -142,16 +136,10 @@ class ImportGalacticBotView(ui.View):
|
|||
|
||||
await interaction.edit_original_response(content="Import complete.")
|
||||
if failed_cases:
|
||||
await interaction.edit_original_response(
|
||||
content="Import complete.\n"
|
||||
+ warning("Failed to import the following cases:\n")
|
||||
+ box(failed_cases)
|
||||
)
|
||||
await interaction.edit_original_response(content="Import complete.\n" + warning("Failed to import the following cases:\n") + box(failed_cases))
|
||||
|
||||
@ui.button(label="No", style=ButtonStyle.danger)
|
||||
async def import_button_n(
|
||||
self, interaction: Interaction, button: ui.Button
|
||||
): # pylint: disable=unused-argument
|
||||
async def import_button_n(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
await self.message.edit(content="Import cancelled.", view=None)
|
||||
await self.message.delete(10)
|
||||
await self.ctx.message.delete(10)
|
||||
|
|
|
@ -23,7 +23,7 @@ class Addrole(ui.View):
|
|||
return
|
||||
await interaction.response.defer()
|
||||
async with config.guild(self.ctx.guild).addrole_whitelist() as addrole_whitelist:
|
||||
addrole_whitelist: list # type hint
|
||||
addrole_whitelist: list # type hint
|
||||
for value in select.values:
|
||||
if value.id in addrole_whitelist:
|
||||
addrole_whitelist.remove(value.id)
|
||||
|
@ -32,7 +32,7 @@ class Addrole(ui.View):
|
|||
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
||||
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's addrole whitelist."), ephemeral=True)
|
||||
return
|
||||
|
@ -41,7 +41,7 @@ class Addrole(ui.View):
|
|||
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Close", style=ButtonStyle.gray)
|
||||
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
||||
return
|
||||
|
|
|
@ -17,7 +17,7 @@ class Guild(ui.View):
|
|||
await self.message.edit(view=None)
|
||||
|
||||
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
|
||||
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -27,7 +27,7 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Use Discord Permissions", style=ButtonStyle.green, row=0)
|
||||
async def use_discord_permissions(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def use_discord_permissions(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -37,7 +37,7 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Respect Hierarchy", style=ButtonStyle.green, row=0)
|
||||
async def respect_heirarchy(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def respect_heirarchy(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -47,7 +47,7 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Ignore Modlog", style=ButtonStyle.green, row=0)
|
||||
async def ignore_modlog(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def ignore_modlog(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -57,7 +57,7 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Ignore Other Bots", style=ButtonStyle.green, row=0)
|
||||
async def ignore_other_bots(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def ignore_other_bots(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -67,7 +67,7 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.button(label="DM Users", style=ButtonStyle.green, row=1)
|
||||
async def dm_users(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def dm_users(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -77,7 +77,7 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=1)
|
||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -87,7 +87,7 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=1)
|
||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -97,7 +97,7 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.button(label="History Inline", style=ButtonStyle.green, row=1)
|
||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -107,7 +107,11 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.select(placeholder="History Pagesize", options=create_pagesize_options(), row=2)
|
||||
async def pagesize(self, interaction: Interaction, select: ui.Select,):
|
||||
async def pagesize(
|
||||
self,
|
||||
interaction: Interaction,
|
||||
select: ui.Select,
|
||||
):
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
@ -119,7 +123,11 @@ class Guild(ui.View):
|
|||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||
|
||||
@ui.select(placeholder="History Inline Pagesize", options=create_pagesize_options(), row=3)
|
||||
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,):
|
||||
async def inline_pagesize(
|
||||
self,
|
||||
interaction: Interaction,
|
||||
select: ui.Select,
|
||||
):
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||
return
|
||||
|
|
|
@ -23,7 +23,7 @@ class Immune(ui.View):
|
|||
return
|
||||
await interaction.response.defer()
|
||||
async with config.guild(self.ctx.guild).immune_roles() as immune_roles:
|
||||
immune_roles: list # type hint
|
||||
immune_roles: list # type hint
|
||||
for value in select.values:
|
||||
if value.id in immune_roles:
|
||||
immune_roles.remove(value.id)
|
||||
|
@ -32,7 +32,7 @@ class Immune(ui.View):
|
|||
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
||||
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's immune roles."), ephemeral=True)
|
||||
return
|
||||
|
@ -41,7 +41,7 @@ class Immune(ui.View):
|
|||
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Close", style=ButtonStyle.gray)
|
||||
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
||||
return
|
||||
|
|
|
@ -17,7 +17,7 @@ class Overrides(ui.View):
|
|||
await self.message.edit(view=None)
|
||||
|
||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0)
|
||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
|
@ -32,7 +32,7 @@ class Overrides(ui.View):
|
|||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
|
@ -47,7 +47,7 @@ class Overrides(ui.View):
|
|||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||
|
||||
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
|
@ -62,7 +62,11 @@ class Overrides(ui.View):
|
|||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||
|
||||
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), row=1)
|
||||
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,):
|
||||
async def inline_pagesize(
|
||||
self,
|
||||
interaction: Interaction,
|
||||
select: ui.Select,
|
||||
):
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
|
@ -74,7 +78,11 @@ class Overrides(ui.View):
|
|||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||
|
||||
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=2)
|
||||
async def pagesize(self, interaction: Interaction, select: ui.Select,):
|
||||
async def pagesize(
|
||||
self,
|
||||
interaction: Interaction,
|
||||
select: ui.Select,
|
||||
):
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
|
|
|
@ -8,23 +8,18 @@ from discord import Guild
|
|||
from redbot.core import data_manager
|
||||
|
||||
from .logger import logger
|
||||
from .utils import (convert_timedelta_to_str, generate_dict,
|
||||
get_next_case_number)
|
||||
from .utils import convert_timedelta_to_str, generate_dict, get_next_case_number
|
||||
|
||||
|
||||
def connect() -> sqlite3.Connection:
|
||||
"""Connects to the SQLite database, and returns a connection object."""
|
||||
try:
|
||||
connection = sqlite3.connect(
|
||||
database=data_manager.cog_data_path(raw_name="Aurora") / "aurora.db"
|
||||
)
|
||||
connection = sqlite3.connect(database=data_manager.cog_data_path(raw_name="Aurora") / "aurora.db")
|
||||
return connection
|
||||
|
||||
except sqlite3.OperationalError as e:
|
||||
logger.error("Unable to access the SQLite database!\nError:\n%s", e.msg)
|
||||
raise ConnectionRefusedError(
|
||||
f"Unable to access the SQLite Database!\n{e.msg}"
|
||||
) from e
|
||||
raise ConnectionRefusedError(f"Unable to access the SQLite Database!\n{e.msg}") from e
|
||||
|
||||
|
||||
async def create_guild_table(guild: Guild):
|
||||
|
|
|
@ -32,24 +32,17 @@ def check_permissions(
|
|||
raise (KeyError)
|
||||
|
||||
for permission in permissions:
|
||||
if (
|
||||
not getattr(resolved_permissions, permission, False)
|
||||
and resolved_permissions.administrator is not True
|
||||
):
|
||||
if not getattr(resolved_permissions, permission, False) and resolved_permissions.administrator is not True:
|
||||
return permission
|
||||
|
||||
return False
|
||||
|
||||
|
||||
async def check_moddable(
|
||||
target: Union[User, Member], interaction: Interaction, permissions: list
|
||||
) -> bool:
|
||||
async def check_moddable(target: Union[User, Member], interaction: Interaction, permissions: list) -> bool:
|
||||
"""Checks if a moderator can moderate a target."""
|
||||
if check_permissions(interaction.client.user, permissions, guild=interaction.guild):
|
||||
await interaction.response.send_message(
|
||||
error(
|
||||
f"I do not have the `{permissions}` permission, required for this action."
|
||||
),
|
||||
error(f"I do not have the `{permissions}` permission, required for this action."),
|
||||
ephemeral=True,
|
||||
)
|
||||
return False
|
||||
|
@ -57,43 +50,30 @@ async def check_moddable(
|
|||
if await config.guild(interaction.guild).use_discord_permissions() is True:
|
||||
if check_permissions(interaction.user, permissions, guild=interaction.guild):
|
||||
await interaction.response.send_message(
|
||||
error(
|
||||
f"You do not have the `{permissions}` permission, required for this action."
|
||||
),
|
||||
error(f"You do not have the `{permissions}` permission, required for this action."),
|
||||
ephemeral=True,
|
||||
)
|
||||
return False
|
||||
|
||||
if interaction.user.id == target.id:
|
||||
await interaction.response.send_message(
|
||||
content="You cannot moderate yourself!", ephemeral=True
|
||||
)
|
||||
await interaction.response.send_message(content="You cannot moderate yourself!", ephemeral=True)
|
||||
return False
|
||||
|
||||
if target.bot:
|
||||
await interaction.response.send_message(
|
||||
content="You cannot moderate bots!", ephemeral=True
|
||||
)
|
||||
await interaction.response.send_message(content="You cannot moderate bots!", ephemeral=True)
|
||||
return False
|
||||
|
||||
if isinstance(target, Member):
|
||||
if interaction.user.top_role <= target.top_role and await config.guild(interaction.guild).respect_hierarchy() is True:
|
||||
await interaction.response.send_message(
|
||||
content=error(
|
||||
"You cannot moderate members with a higher role than you!"
|
||||
),
|
||||
content=error("You cannot moderate members with a higher role than you!"),
|
||||
ephemeral=True,
|
||||
)
|
||||
return False
|
||||
|
||||
if (
|
||||
interaction.guild.get_member(interaction.client.user.id).top_role
|
||||
<= target.top_role
|
||||
):
|
||||
if interaction.guild.get_member(interaction.client.user.id).top_role <= target.top_role:
|
||||
await interaction.response.send_message(
|
||||
content=error(
|
||||
"You cannot moderate members with a role higher than the bot!"
|
||||
),
|
||||
content=error("You cannot moderate members with a role higher than the bot!"),
|
||||
ephemeral=True,
|
||||
)
|
||||
return False
|
||||
|
@ -118,9 +98,7 @@ async def get_next_case_number(guild_id: str, cursor=None) -> int:
|
|||
if not cursor:
|
||||
database = connect()
|
||||
cursor = database.cursor()
|
||||
cursor.execute(
|
||||
f"SELECT moderation_id FROM `moderation_{guild_id}` ORDER BY moderation_id DESC LIMIT 1"
|
||||
)
|
||||
cursor.execute(f"SELECT moderation_id FROM `moderation_{guild_id}` ORDER BY moderation_id DESC LIMIT 1")
|
||||
result = cursor.fetchone()
|
||||
return (result[0] + 1) if result else 1
|
||||
|
||||
|
@ -171,7 +149,6 @@ async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict:
|
|||
"discriminator": "0",
|
||||
}
|
||||
|
||||
|
||||
return user_dict
|
||||
|
||||
|
||||
|
@ -216,9 +193,7 @@ async def log(interaction: Interaction, moderation_id: int, resolved: bool = Fal
|
|||
|
||||
case = await fetch_case(moderation_id, interaction.guild.id)
|
||||
if case:
|
||||
embed = await log_factory(
|
||||
interaction=interaction, case_dict=case, resolved=resolved
|
||||
)
|
||||
embed = await log_factory(interaction=interaction, case_dict=case, resolved=resolved)
|
||||
try:
|
||||
await logging_channel.send(embed=embed)
|
||||
except Forbidden:
|
||||
|
@ -229,11 +204,7 @@ async def send_evidenceformat(interaction: Interaction, case_dict: dict) -> None
|
|||
"""This function sends an ephemeral message to the moderator who took the moderation action, with a pre-made codeblock for use in the mod-evidence channel."""
|
||||
from .factory import evidenceformat_factory
|
||||
|
||||
send_evidence_bool = (
|
||||
await config.user(interaction.user).auto_evidenceformat()
|
||||
or await config.guild(interaction.guild).auto_evidenceformat()
|
||||
or False
|
||||
)
|
||||
send_evidence_bool = await config.user(interaction.user).auto_evidenceformat() or await config.guild(interaction.guild).auto_evidenceformat() or False
|
||||
if send_evidence_bool is False:
|
||||
return
|
||||
|
||||
|
@ -286,12 +257,14 @@ def create_pagesize_options() -> list[SelectOption]:
|
|||
)
|
||||
return options
|
||||
|
||||
|
||||
def timedelta_from_relativedelta(relativedelta: rd) -> td:
|
||||
"""Converts a relativedelta object to a timedelta object."""
|
||||
now = datetime.now()
|
||||
then = now - relativedelta
|
||||
return now - then
|
||||
|
||||
|
||||
def get_footer_image(coginstance: commands.Cog) -> File:
|
||||
"""Returns the footer image for the embeds."""
|
||||
image_path = data_manager.bundled_data_path(coginstance) / "arrow.png"
|
||||
|
|
Loading…
Add table
Reference in a new issue