From bbe8b281d1c3650fbe91b406c42e49eb2a58a98a Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Mon, 3 Jun 2024 23:46:22 -0400 Subject: [PATCH] misc(aurora): changed two typehints in aurora.utilities.utils and added other typehints --- aurora/aurora.py | 2 +- aurora/models/moderation.py | 6 +++--- aurora/utilities/utils.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/aurora/aurora.py b/aurora/aurora.py index 8e422e0..1d4052b 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -1191,7 +1191,7 @@ class Aurora(commands.Cog): Reason for resolving case""" permissions = check_permissions( interaction.client.user, - ["embed_links", "moderate_members", "ban_members"], + ("embed_links", "moderate_members", "ban_members"), interaction, ) if permissions: diff --git a/aurora/models/moderation.py b/aurora/models/moderation.py index e3a6e3f..478768f 100644 --- a/aurora/models/moderation.py +++ b/aurora/models/moderation.py @@ -63,10 +63,10 @@ class Moderation(AuroraGuildModel): return await PartialRole.from_id(self.bot, self.guild_id, self.role_id) return None - def __str__(self): + def __str__(self) -> str: return f"{self.moderation_type} {self.target_type} {self.target_id} {self.reason}" - async def resolve(self, resolved_by: int, reason: str): + async def resolve(self, resolved_by: int, reason: str) -> None: if self.resolved: raise ValueError("Case is already resolved!") @@ -113,7 +113,7 @@ class Moderation(AuroraGuildModel): self.update() - def update(self): + def update(self) -> None: from ..utilities.database import connect from ..utilities.json import dumps query = f"UPDATE moderation_{self.guild_id} SET timestamp = ?, moderation_type = ?, target_type = ?, moderator_id = ?, role_id = ?, duration = ?, end_timestamp = ?, reason = ?, resolved = ?, resolved_by = ?, resolve_reason = ?, expired = ?, changes = ?, metadata = ? WHERE moderation_id = ?;" diff --git a/aurora/utilities/utils.py b/aurora/utilities/utils.py index 42ce1cb..b70ec83 100644 --- a/aurora/utilities/utils.py +++ b/aurora/utilities/utils.py @@ -1,6 +1,6 @@ # pylint: disable=cyclic-import from datetime import datetime, timedelta -from typing import Optional, Union +from typing import Optional, Tuple, Union from dateutil.relativedelta import relativedelta as rd from discord import File, Guild, Interaction, Member, SelectOption, TextChannel, User @@ -13,7 +13,7 @@ from ..utilities.config import config def check_permissions( user: User, - permissions: list, + permissions: Tuple[str], ctx: Union[commands.Context, Interaction] | None = None, guild: Guild | None = None, ) -> Union[bool, str]: @@ -40,7 +40,7 @@ def check_permissions( async def check_moddable( - target: Union[User, Member, TextChannel], interaction: Interaction, permissions: list + target: Union[User, Member, TextChannel], interaction: Interaction, permissions: Tuple[str] ) -> bool: """Checks if a moderator can moderate a target.""" is_channel = isinstance(target, TextChannel)