fix(aurora): more ruff fixes
This commit is contained in:
parent
4407a99b8e
commit
2505dd0980
4 changed files with 14 additions and 24 deletions
|
@ -40,7 +40,7 @@ class Aurora(commands.Cog):
|
|||
This cog stores all of its data in an SQLite database."""
|
||||
|
||||
__author__ = ["cswimr"]
|
||||
__version__ = "2.1.4"
|
||||
__version__ = "2.1.5"
|
||||
__documentation__ = "https://seacogs.coastalcommits.com/aurora/"
|
||||
|
||||
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
||||
|
@ -872,7 +872,7 @@ class Aurora(commands.Cog):
|
|||
silent = not await config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = embed = await message_factory(
|
||||
embed = await message_factory(
|
||||
await self.bot.get_embed_color(interaction.channel),
|
||||
guild=interaction.guild,
|
||||
moderator=interaction.user,
|
||||
|
|
|
@ -14,12 +14,12 @@ 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")
|
||||
return connection
|
||||
return sqlite3.connect(database=data_manager.cog_data_path(raw_name="Aurora") / "aurora.db")
|
||||
|
||||
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
|
||||
msg = f"Unable to access the SQLite Database!\n{e.msg}"
|
||||
raise ConnectionRefusedError(msg) from e
|
||||
|
||||
|
||||
async def create_guild_table(guild: Guild):
|
||||
|
|
|
@ -451,7 +451,7 @@ async def addrole_embed(ctx: commands.Context) -> Embed:
|
|||
"id": evalulated_role.id,
|
||||
"mention": evalulated_role.mention,
|
||||
"position": evalulated_role.position,
|
||||
}
|
||||
},
|
||||
)
|
||||
else:
|
||||
roles.append(
|
||||
|
@ -459,7 +459,7 @@ async def addrole_embed(ctx: commands.Context) -> Embed:
|
|||
"id": role,
|
||||
"mention": error(f"`{role}` (Not Found)"),
|
||||
"position": 0,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
if roles:
|
||||
|
@ -506,7 +506,7 @@ async def immune_embed(ctx: commands.Context) -> Embed:
|
|||
"id": evalulated_role.id,
|
||||
"mention": evalulated_role.mention,
|
||||
"position": evalulated_role.position,
|
||||
}
|
||||
},
|
||||
)
|
||||
else:
|
||||
roles.append(
|
||||
|
@ -514,7 +514,7 @@ async def immune_embed(ctx: commands.Context) -> Embed:
|
|||
"id": role,
|
||||
"mention": error(f"`{role}` (Not Found)"),
|
||||
"position": 0,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
if roles:
|
||||
|
|
|
@ -104,7 +104,7 @@ async def get_next_case_number(guild_id: str, cursor=None) -> int:
|
|||
|
||||
|
||||
def generate_dict(result) -> dict:
|
||||
case = {
|
||||
return {
|
||||
"moderation_id": result[0],
|
||||
"timestamp": result[1],
|
||||
"moderation_type": result[2],
|
||||
|
@ -122,7 +122,6 @@ def generate_dict(result) -> dict:
|
|||
"changes": json.loads(result[14]),
|
||||
"metadata": json.loads(result[15]),
|
||||
}
|
||||
return case
|
||||
|
||||
|
||||
async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict:
|
||||
|
@ -175,11 +174,9 @@ async def fetch_role_dict(guild: Guild, role_id: int) -> dict:
|
|||
"""This function returns a dictionary containing either role information or a standard deleted role template."""
|
||||
role = guild.get_role(int(role_id))
|
||||
if not role:
|
||||
role_dict = {"id": role_id, "name": "Deleted Role"}
|
||||
pass
|
||||
|
||||
role_dict = {"id": role.id, "name": role.name}
|
||||
|
||||
return role_dict
|
||||
return {"id": role.id, "name": role.name}
|
||||
|
||||
|
||||
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False) -> None:
|
||||
|
@ -245,16 +242,9 @@ def create_pagesize_options() -> list[SelectOption]:
|
|||
label="Default",
|
||||
value="default",
|
||||
description="Reset the pagesize to the default value.",
|
||||
)
|
||||
),
|
||||
)
|
||||
for i in range(1, 21):
|
||||
options.append(
|
||||
SelectOption(
|
||||
label=str(i),
|
||||
value=str(i),
|
||||
description=f"Set the pagesize to {i}.",
|
||||
)
|
||||
)
|
||||
options.extend(SelectOption(label=str(i), value=str(i), description=f"Set the pagesize to {i}") for i in range(1, 21))
|
||||
return options
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue