diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a3779b3..9126c4e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,7 @@ expand the bot's functionality. Please follow these guidelines when contributing poetry install poetry shell poetry pre-commit install + poetry run pre-commit run --all-files ``` ## Making Changes diff --git a/handlers/reaction_handler.py b/handlers/reaction_handler.py index 2b99f3c..177efe8 100644 --- a/handlers/reaction_handler.py +++ b/handlers/reaction_handler.py @@ -77,7 +77,7 @@ class ReactionListener(Cog): :param message: The message to process. """ if not message.author.bot and not BlacklistUserService.is_user_blacklisted( - message.author.id, + message.author.id, ): await ReactionHandler(self.client, message).run_checks() diff --git a/handlers/xp_handler.py b/handlers/xp_handler.py index 76b2ed7..c36e5b5 100644 --- a/handlers/xp_handler.py +++ b/handlers/xp_handler.py @@ -103,9 +103,9 @@ class XPHandler: if role := self.guild.get_role(role_id): with contextlib.suppress( - discord.Forbidden, - discord.NotFound, - discord.HTTPException, + discord.Forbidden, + discord.NotFound, + discord.HTTPException, ): if isinstance(self.author, discord.Member): await self.author.add_roles(role, reason=reason) @@ -114,16 +114,16 @@ class XPHandler: if replace and isinstance(self.author, discord.Member): if role := self.guild.get_role(previous or role_id): with contextlib.suppress( - discord.Forbidden, - discord.NotFound, - discord.HTTPException, + discord.Forbidden, + discord.NotFound, + discord.HTTPException, ): await self.author.remove_roles(role, reason=reason) async def get_level_channel( - self, - message: discord.Message, - guild_config: GuildConfig, + self, + message: discord.Message, + guild_config: GuildConfig, ) -> Optional[discord.TextChannel]: """ Retrieves the level up notification channel for the guild. @@ -147,9 +147,9 @@ class XPHandler: @staticmethod async def get_level_message( - guild_config: GuildConfig, - level_config: XpService, - author: discord.Member, + guild_config: GuildConfig, + level_config: XpService, + author: discord.Member, ) -> Optional[str]: """ Retrieves the level up message for the user. diff --git a/lib/embed_builder.py b/lib/embed_builder.py index 67c2bcb..1470daa 100644 --- a/lib/embed_builder.py +++ b/lib/embed_builder.py @@ -8,22 +8,22 @@ from lib.constants import CONST class EmbedBuilder: @staticmethod def create_embed( - ctx, - title=None, - author_text=None, - author_icon_url=None, - author_url=None, - description=None, - color=None, - footer_text=None, - footer_icon_url=None, - show_name=True, - image_url=None, - thumbnail_url=None, - timestamp=None, - hide_author=False, - hide_author_icon=False, - hide_timestamp=False, + ctx, + title=None, + author_text=None, + author_icon_url=None, + author_url=None, + description=None, + color=None, + footer_text=None, + footer_icon_url=None, + show_name=True, + image_url=None, + thumbnail_url=None, + timestamp=None, + hide_author=False, + hide_author_icon=False, + hide_timestamp=False, ): if not hide_author: if not author_text: @@ -63,20 +63,20 @@ class EmbedBuilder: @staticmethod def create_error_embed( - ctx, - title=None, - author_text=None, - author_icon_url=None, - author_url=None, - description=None, - footer_text=None, - show_name=True, - image_url=None, - thumbnail_url=None, - timestamp=None, - hide_author=False, - hide_author_icon=False, - hide_timestamp=False, + ctx, + title=None, + author_text=None, + author_icon_url=None, + author_url=None, + description=None, + footer_text=None, + show_name=True, + image_url=None, + thumbnail_url=None, + timestamp=None, + hide_author=False, + hide_author_icon=False, + hide_timestamp=False, ): return EmbedBuilder.create_embed( ctx, @@ -99,20 +99,20 @@ class EmbedBuilder: @staticmethod def create_success_embed( - ctx, - title=None, - author_text=None, - author_icon_url=None, - author_url=None, - description=None, - footer_text=None, - show_name=True, - image_url=None, - thumbnail_url=None, - timestamp=None, - hide_author=False, - hide_author_icon=False, - hide_timestamp=False, + ctx, + title=None, + author_text=None, + author_icon_url=None, + author_url=None, + description=None, + footer_text=None, + show_name=True, + image_url=None, + thumbnail_url=None, + timestamp=None, + hide_author=False, + hide_author_icon=False, + hide_timestamp=False, ): return EmbedBuilder.create_embed( ctx, @@ -135,20 +135,20 @@ class EmbedBuilder: @staticmethod def create_info_embed( - ctx, - title=None, - author_text=None, - author_icon_url=None, - author_url=None, - description=None, - footer_text=None, - show_name=True, - image_url=None, - thumbnail_url=None, - timestamp=None, - hide_author=False, - hide_author_icon=False, - hide_timestamp=False, + ctx, + title=None, + author_text=None, + author_icon_url=None, + author_url=None, + description=None, + footer_text=None, + show_name=True, + image_url=None, + thumbnail_url=None, + timestamp=None, + hide_author=False, + hide_author_icon=False, + hide_timestamp=False, ): return EmbedBuilder.create_embed( ctx, @@ -171,20 +171,20 @@ class EmbedBuilder: @staticmethod def create_warning_embed( - ctx, - title=None, - author_text=None, - author_icon_url=None, - author_url=None, - description=None, - footer_text=None, - show_name=True, - image_url=None, - thumbnail_url=None, - timestamp=None, - hide_author=False, - hide_author_icon=False, - hide_timestamp=False, + ctx, + title=None, + author_text=None, + author_icon_url=None, + author_url=None, + description=None, + footer_text=None, + show_name=True, + image_url=None, + thumbnail_url=None, + timestamp=None, + hide_author=False, + hide_author_icon=False, + hide_timestamp=False, ): return EmbedBuilder.create_embed( ctx, diff --git a/lib/interactions/introduction.py b/lib/interactions/introduction.py index ce48b0a..f63627b 100644 --- a/lib/interactions/introduction.py +++ b/lib/interactions/introduction.py @@ -51,9 +51,9 @@ class IntroductionFinishButtons(View): @discord.ui.button(label="Post it!", style=discord.ButtonStyle.green) async def short_button_callback( - self, - button: discord.ui.Button, - interaction: discord.Interaction, + self, + button: discord.ui.Button, + interaction: discord.Interaction, ) -> None: await interaction.response.edit_message(view=None) self.clickedConfirm = True @@ -61,9 +61,9 @@ class IntroductionFinishButtons(View): @discord.ui.button(label="Stop", style=discord.ButtonStyle.red) async def extended_button_callback( - self, - button: discord.ui.Button, - interaction: discord.Interaction, + self, + button: discord.ui.Button, + interaction: discord.Interaction, ) -> None: await interaction.response.edit_message(view=None) self.stop() diff --git a/lib/reactions.py b/lib/reactions.py index 7a28079..9ccb5b2 100644 --- a/lib/reactions.py +++ b/lib/reactions.py @@ -30,7 +30,7 @@ class ReactionHandler: content = message.content.lower() if ( - content.startswith("Lumi ") or content.startswith("Lumi, ") + content.startswith("Lumi ") or content.startswith("Lumi, ") ) and content.endswith("?"): response = random.choice(self.eightball) await message.reply(content=response) diff --git a/modules/admin/blacklist.py b/modules/admin/blacklist.py index 4af1a6c..815f649 100644 --- a/modules/admin/blacklist.py +++ b/modules/admin/blacklist.py @@ -8,9 +8,9 @@ from services.blacklist_service import BlacklistUserService async def blacklist_user( - ctx, - user: discord.User, - reason: Optional[str] = None, + ctx, + user: discord.User, + reason: Optional[str] = None, ) -> None: blacklist_service = BlacklistUserService(user.id) blacklist_service.add_to_blacklist(reason) diff --git a/modules/config/__init__.py b/modules/config/__init__.py index a0503d9..b2cff77 100644 --- a/modules/config/__init__.py +++ b/modules/config/__init__.py @@ -39,11 +39,11 @@ class Config(commands.Cog): @guild_only() @commands.has_permissions(manage_roles=True) async def xp_reward_command_add( - self, - ctx, - level: int, - role: discord.Role, - persistent: bool = False, + self, + ctx, + level: int, + role: discord.Role, + persistent: bool = False, ): await xp_reward.add_reward(ctx, level, role.id, persistent) diff --git a/modules/config/c_boost.py b/modules/config/c_boost.py index fbfbe39..ff0c271 100644 --- a/modules/config/c_boost.py +++ b/modules/config/c_boost.py @@ -104,9 +104,9 @@ async def set_boost_image(ctx, image_url: str | None): async def create_boost_embed( - member: discord.Member, - template: str | None = None, - image_url: str | None = None, + member: discord.Member, + template: str | None = None, + image_url: str | None = None, ): embed = discord.Embed( color=discord.Color.nitro_pink(), diff --git a/modules/config/c_greet.py b/modules/config/c_greet.py index 1fdb839..547703c 100644 --- a/modules/config/c_greet.py +++ b/modules/config/c_greet.py @@ -77,8 +77,8 @@ async def set_welcome_template(ctx, text: str) -> None: def create_greet_embed( - member: discord.Member, - template: Optional[str] = None, + member: discord.Member, + template: Optional[str] = None, ) -> discord.Embed: embed: discord.Embed = discord.Embed( color=discord.Color.embed_background(), diff --git a/modules/economy/__init__.py b/modules/economy/__init__.py index ae8a3e7..6727395 100644 --- a/modules/economy/__init__.py +++ b/modules/economy/__init__.py @@ -14,7 +14,7 @@ class Economy(commands.Cog): aliases=["bal", "$"], description="Shows your current Lumi balance.", help="Shows your current Lumi balance. The economy system is global, meaning your balance will be synced in " - "all servers.", + "all servers.", contexts={discord.InteractionContextType.guild}, ) @guild_only() diff --git a/modules/economy/blackjack.py b/modules/economy/blackjack.py index a762e8d..1e2bb76 100644 --- a/modules/economy/blackjack.py +++ b/modules/economy/blackjack.py @@ -178,12 +178,12 @@ async def cmd(ctx, bet: int): def blackjack_show( - ctx, - bet, - player_hand, - dealer_hand, - player_hand_value, - dealer_hand_value, + ctx, + bet, + player_hand, + dealer_hand, + player_hand_value, + dealer_hand_value, ): current_time = datetime.now(est).strftime("%I:%M %p") embed = discord.Embed( diff --git a/modules/levels/leaderboard.py b/modules/levels/leaderboard.py index c2180a2..381f26b 100644 --- a/modules/levels/leaderboard.py +++ b/modules/levels/leaderboard.py @@ -132,8 +132,8 @@ class LeaderboardCommandView(discord.ui.View): embed.set_author(name=CONST.STRINGS["xp_lb_author"], icon_url=icon) for rank, (user_id, xp, level, xp_needed_for_next_level) in enumerate( - xp_lb[:5], - start=1, + xp_lb[:5], + start=1, ): try: member = await self.ctx.guild.fetch_member(user_id) diff --git a/modules/misc/__init__.py b/modules/misc/__init__.py index 20d0d96..77844c3 100644 --- a/modules/misc/__init__.py +++ b/modules/misc/__init__.py @@ -99,7 +99,7 @@ class Misc(commands.Cog): aliases=["intro", "introduce"], description="This command can only be used in DMs.", help="Introduce yourself. For now this command " - "can only be done in ONE server and only in Lumi's DMs.", + "can only be done in ONE server and only in Lumi's DMs.", contexts={discord.InteractionContextType.bot_dm}, ) @commands.dm_only() diff --git a/modules/misc/introduction.py b/modules/misc/introduction.py index e0cc59b..f0ee366 100644 --- a/modules/misc/introduction.py +++ b/modules/misc/introduction.py @@ -35,8 +35,8 @@ async def cmd(self, ctx: bridge.Context) -> None: ) if not channel or isinstance( - channel, - (discord.ForumChannel, discord.CategoryChannel), + channel, + (discord.ForumChannel, discord.CategoryChannel), ): await ctx.respond( embed=EmbedBuilder.create_error_embed( diff --git a/modules/misc/xkcd.py b/modules/misc/xkcd.py index 421aafc..0b88120 100644 --- a/modules/misc/xkcd.py +++ b/modules/misc/xkcd.py @@ -10,9 +10,9 @@ _xkcd = Client() async def print_comic( - ctx: bridge.Context, - latest: bool = False, - number: Optional[int] = None, + ctx: bridge.Context, + latest: bool = False, + number: Optional[int] = None, ) -> None: try: if latest: diff --git a/modules/moderation/__init__.py b/modules/moderation/__init__.py index ba1f1da..730d70a 100644 --- a/modules/moderation/__init__.py +++ b/modules/moderation/__init__.py @@ -20,11 +20,11 @@ class Moderation(commands.Cog): @commands.bot_has_permissions(ban_members=True) @guild_only() async def ban_command( - self, - ctx, - target: discord.User, - *, - reason: str | None = None, + self, + ctx, + target: discord.User, + *, + reason: str | None = None, ): await ban.ban_user(self, ctx, target, reason) @@ -75,11 +75,11 @@ class Moderation(commands.Cog): @commands.bot_has_permissions(kick_members=True) @guild_only() async def kick_command( - self, - ctx, - target: discord.Member, - *, - reason: str | None = None, + self, + ctx, + target: discord.Member, + *, + reason: str | None = None, ): await kick.kick_user(self, ctx, target, reason) @@ -106,11 +106,11 @@ class Moderation(commands.Cog): @commands.bot_has_permissions(ban_members=True) @guild_only() async def softban_command( - self, - ctx, - target: discord.Member, - *, - reason: str | None = None, + self, + ctx, + target: discord.Member, + *, + reason: str | None = None, ): await softban.softban_user(ctx, target, reason) @@ -125,12 +125,12 @@ class Moderation(commands.Cog): @commands.bot_has_permissions(moderate_members=True) @guild_only() async def timeout_command( - self, - ctx, - target: discord.Member, - duration: str, - *, - reason: str | None = None, + self, + ctx, + target: discord.Member, + duration: str, + *, + reason: str | None = None, ): await timeout.timeout_user(self, ctx, target, duration, reason) @@ -145,11 +145,11 @@ class Moderation(commands.Cog): @commands.bot_has_permissions(ban_members=True) @guild_only() async def unban_command( - self, - ctx, - target: discord.User, - *, - reason: str | None = None, + self, + ctx, + target: discord.User, + *, + reason: str | None = None, ): await ban.unban_user(ctx, target, reason) @@ -164,11 +164,11 @@ class Moderation(commands.Cog): @commands.bot_has_permissions(moderate_members=True) @guild_only() async def untimeout_command( - self, - ctx, - target: discord.Member, - *, - reason: str | None = None, + self, + ctx, + target: discord.Member, + *, + reason: str | None = None, ): await timeout.untimeout_user(ctx, target, reason) @@ -182,11 +182,11 @@ class Moderation(commands.Cog): @bridge.has_permissions(kick_members=True) @guild_only() async def warn_command( - self, - ctx, - target: discord.Member, - *, - reason: str | None = None, + self, + ctx, + target: discord.Member, + *, + reason: str | None = None, ): await warn.warn_user(ctx, target, reason) diff --git a/modules/moderation/cases.py b/modules/moderation/cases.py index a31b5c6..5d56c58 100644 --- a/modules/moderation/cases.py +++ b/modules/moderation/cases.py @@ -54,7 +54,7 @@ async def view_all_cases_in_guild(ctx, guild_id: int): pages_list = [] for i in range(0, len(cases), 10): - chunk = cases[i: i + 10] + chunk = cases[i : i + 10] embed = create_case_list_embed( ctx, chunk, @@ -79,7 +79,7 @@ async def view_all_cases_by_mod(ctx, guild_id: int, moderator: discord.Member): pages_list = [] for i in range(0, len(cases), 10): - chunk = cases[i: i + 10] + chunk = cases[i : i + 10] embed = create_case_list_embed( ctx, chunk, diff --git a/modules/moderation/timeout.py b/modules/moderation/timeout.py index 8b52bee..5075f8e 100644 --- a/modules/moderation/timeout.py +++ b/modules/moderation/timeout.py @@ -14,11 +14,11 @@ from modules.moderation.utils.case_handler import create_case async def timeout_user( - cog, - ctx, - target: discord.Member, - duration: str, - reason: Optional[str] = None, + cog, + ctx, + target: discord.Member, + duration: str, + reason: Optional[str] = None, ): bot_member = await MemberConverter().convert(ctx, str(ctx.bot.user.id)) await async_actionable(target, ctx.author, bot_member) diff --git a/modules/moderation/utils/actionable.py b/modules/moderation/utils/actionable.py index 230197a..5b0d811 100644 --- a/modules/moderation/utils/actionable.py +++ b/modules/moderation/utils/actionable.py @@ -5,9 +5,9 @@ from lib.exceptions.LumiExceptions import LumiException async def async_actionable( - target: discord.Member, - invoker: discord.Member, - bot_user: discord.Member, + target: discord.Member, + invoker: discord.Member, + bot_user: discord.Member, ) -> None: """ Checks if the invoker and client have a higher role than the target user. diff --git a/modules/moderation/utils/case_embed.py b/modules/moderation/utils/case_embed.py index 4b23d07..c0bd3fd 100644 --- a/modules/moderation/utils/case_embed.py +++ b/modules/moderation/utils/case_embed.py @@ -10,13 +10,13 @@ from lib.formatter import format_seconds_to_duration_string def create_case_embed( - ctx, - target: discord.User, - case_number: int, - action_type: str, - reason: Optional[str], - timestamp: Optional[datetime.datetime] = None, - duration: Optional[int] = None, + ctx, + target: discord.User, + case_number: int, + action_type: str, + reason: Optional[str], + timestamp: Optional[datetime.datetime] = None, + duration: Optional[int] = None, ) -> discord.Embed: embed = EmbedBuilder.create_warning_embed( ctx, diff --git a/modules/moderation/utils/case_handler.py b/modules/moderation/utils/case_handler.py index 7ca0c52..024e040 100644 --- a/modules/moderation/utils/case_handler.py +++ b/modules/moderation/utils/case_handler.py @@ -13,12 +13,12 @@ modlog_service = ModLogService() async def create_case( - ctx, - target: discord.User, - action_type: str, - reason: Optional[str] = None, - duration: Optional[int] = None, - expires_at: Optional[str] = None, + ctx, + target: discord.User, + action_type: str, + reason: Optional[str] = None, + duration: Optional[int] = None, + expires_at: Optional[str] = None, ): """ Creates a new moderation case and logs it to the modlog channel if configured. @@ -90,10 +90,10 @@ async def create_case( async def edit_case_modlog( - ctx, - guild_id: int, - case_number: int, - new_reason: str, + ctx, + guild_id: int, + case_number: int, + new_reason: str, ) -> bool: """ Edits the reason for an existing case and updates the modlog message if it exists. diff --git a/modules/triggers/__init__.py b/modules/triggers/__init__.py index 7c82fe8..7a664d5 100644 --- a/modules/triggers/__init__.py +++ b/modules/triggers/__init__.py @@ -28,11 +28,11 @@ class Triggers(commands.Cog): ) @guild_only() async def add_text_reaction_command( - self, - ctx, - trigger_text: str, - response: str, - is_full_match: bool, + self, + ctx, + trigger_text: str, + response: str, + is_full_match: bool, ): await add_reaction(ctx, trigger_text, response, None, False, is_full_match) @@ -43,11 +43,11 @@ class Triggers(commands.Cog): ) @guild_only() async def add_emoji_reaction_command( - self, - ctx, - trigger_text: str, - emoji: discord.Emoji, - is_full_match: bool, + self, + ctx, + trigger_text: str, + emoji: discord.Emoji, + is_full_match: bool, ): await add_reaction(ctx, trigger_text, None, emoji.id, True, is_full_match) @@ -58,9 +58,9 @@ class Triggers(commands.Cog): ) @guild_only() async def delete_reaction_command( - self, - ctx, - reaction_id: int, + self, + ctx, + reaction_id: int, ): await delete_reaction(ctx, reaction_id) @@ -71,8 +71,8 @@ class Triggers(commands.Cog): ) @guild_only() async def list_reactions_command( - self, - ctx, + self, + ctx, ): await list_reactions(ctx) diff --git a/modules/triggers/add.py b/modules/triggers/add.py index 694e7bd..81a9819 100644 --- a/modules/triggers/add.py +++ b/modules/triggers/add.py @@ -10,12 +10,12 @@ from services.reactions_service import CustomReactionsService async def add_reaction( - ctx: bridge.Context, - trigger_text: str, - response: Optional[str], - emoji_id: Optional[int], - is_emoji: bool, - is_full_match: bool, + ctx: bridge.Context, + trigger_text: str, + response: Optional[str], + emoji_id: Optional[int], + is_emoji: bool, + is_full_match: bool, ) -> None: if ctx.guild is None: return @@ -25,15 +25,15 @@ async def add_reaction( creator_id: int = ctx.author.id if not await check_reaction_limit( - reaction_service, - guild_id, + reaction_service, + guild_id, ): return if not await check_existing_trigger( - reaction_service, - guild_id, - trigger_text, + reaction_service, + guild_id, + trigger_text, ): return @@ -83,8 +83,8 @@ async def add_reaction( async def check_reaction_limit( - reaction_service: CustomReactionsService, - guild_id: int, + reaction_service: CustomReactionsService, + guild_id: int, ) -> bool: limit_reached = await reaction_service.count_custom_reactions(guild_id) >= 100 @@ -95,9 +95,9 @@ async def check_reaction_limit( async def check_existing_trigger( - reaction_service: CustomReactionsService, - guild_id: int, - trigger_text: str, + reaction_service: CustomReactionsService, + guild_id: int, + trigger_text: str, ) -> bool: existing_trigger = await reaction_service.find_trigger(guild_id, trigger_text) diff --git a/services/daily_service.py b/services/daily_service.py index eef5bb3..9e5e119 100644 --- a/services/daily_service.py +++ b/services/daily_service.py @@ -69,14 +69,14 @@ class Dailies: """ check_1: bool = ( - self.claimed_at.date() == (self.time_now - timedelta(days=1)).date() + self.claimed_at.date() == (self.time_now - timedelta(days=1)).date() ) check_2: bool = ( - self.claimed_at.date() == (self.time_now - timedelta(days=2)).date() + self.claimed_at.date() == (self.time_now - timedelta(days=2)).date() ) check_3: bool = ( - self.claimed_at.date() == self.time_now.date() - and self.claimed_at < self.reset_time + self.claimed_at.date() == self.time_now.date() + and self.claimed_at < self.reset_time ) return check_1 or check_2 or check_3 diff --git a/services/moderation/case_service.py b/services/moderation/case_service.py index 90c6d6e..aaaf25b 100644 --- a/services/moderation/case_service.py +++ b/services/moderation/case_service.py @@ -8,15 +8,15 @@ class CaseService: pass def create_case( - self, - guild_id: int, - target_id: int, - moderator_id: int, - action_type: str, - reason: Optional[str] = None, - duration: Optional[int] = None, - expires_at: Optional[str] = None, - modlog_message_id: Optional[int] = None, + self, + guild_id: int, + target_id: int, + moderator_id: int, + action_type: str, + reason: Optional[str] = None, + duration: Optional[int] = None, + expires_at: Optional[str] = None, + modlog_message_id: Optional[int] = None, ) -> int: # Get the next case number for the guild query: str = """ @@ -63,10 +63,10 @@ class CaseService: execute_query(query, (guild_id, case_number)) def edit_case_reason( - self, - guild_id: int, - case_number: int, - new_reason: Optional[str] = None, + self, + guild_id: int, + case_number: int, + new_reason: Optional[str] = None, ) -> bool: query = """ UPDATE cases @@ -103,9 +103,9 @@ class CaseService: return result[0] if result else None def fetch_case_by_guild_and_number( - self, - guild_id: int, - case_number: int, + self, + guild_id: int, + case_number: int, ) -> Optional[Dict[str, Any]]: query: str = """ SELECT * FROM cases @@ -126,9 +126,9 @@ class CaseService: return results def fetch_cases_by_target( - self, - guild_id: int, - target_id: int, + self, + guild_id: int, + target_id: int, ) -> List[Dict[str, Any]]: query: str = """ SELECT * FROM cases @@ -139,9 +139,9 @@ class CaseService: return results def fetch_cases_by_moderator( - self, - guild_id: int, - moderator_id: int, + self, + guild_id: int, + moderator_id: int, ) -> List[Dict[str, Any]]: query: str = """ SELECT * FROM cases @@ -155,9 +155,9 @@ class CaseService: return results def fetch_cases_by_action_type( - self, - guild_id: int, - action_type: str, + self, + guild_id: int, + action_type: str, ) -> List[Dict[str, Any]]: query: str = """ SELECT * FROM cases diff --git a/services/reactions_service.py b/services/reactions_service.py index f713cf0..7f672ec 100644 --- a/services/reactions_service.py +++ b/services/reactions_service.py @@ -9,9 +9,9 @@ class CustomReactionsService: pass async def find_trigger( - self, - guild_id: int, - message_content: str, + self, + guild_id: int, + message_content: str, ) -> Optional[Dict[str, Any]]: message_content = message_content.lower() query = """ @@ -24,8 +24,8 @@ class CustomReactionsService: LIMIT 1 """ if result := database.select_query( - query, - (guild_id, message_content, message_content, guild_id), + query, + (guild_id, message_content, message_content, guild_id), ): reaction = result[0] # Get the first result from the list return { @@ -96,15 +96,15 @@ class CustomReactionsService: ] async def create_custom_reaction( - self, - guild_id: int, - creator_id: int, - trigger_text: str, - response: Optional[str] = None, - emoji_id: Optional[int] = None, - is_emoji: bool = False, - is_full_match: bool = False, - is_global: bool = True, + self, + guild_id: int, + creator_id: int, + trigger_text: str, + response: Optional[str] = None, + emoji_id: Optional[int] = None, + is_emoji: bool = False, + is_full_match: bool = False, + is_global: bool = True, ) -> bool: if await self.count_custom_reactions(guild_id) >= 100: return False @@ -130,13 +130,13 @@ class CustomReactionsService: return True async def edit_custom_reaction( - self, - reaction_id: int, - new_response: Optional[str] = None, - new_emoji_id: Optional[int] = None, - is_emoji: Optional[bool] = None, - is_full_match: Optional[bool] = None, - is_global: Optional[bool] = None, + self, + reaction_id: int, + new_response: Optional[str] = None, + new_emoji_id: Optional[int] = None, + is_emoji: Optional[bool] = None, + is_full_match: Optional[bool] = None, + is_global: Optional[bool] = None, ) -> bool: query = """ UPDATE custom_reactions diff --git a/services/xkcd_service.py b/services/xkcd_service.py index 88aae22..e7f5b30 100644 --- a/services/xkcd_service.py +++ b/services/xkcd_service.py @@ -30,11 +30,11 @@ class Comic: """ def __init__( - self, - xkcd_dict: dict[str, Any], - raw_image: bytes | None = None, - comic_url: str | None = None, - explanation_url: str | None = None, + self, + xkcd_dict: dict[str, Any], + raw_image: bytes | None = None, + comic_url: str | None = None, + explanation_url: str | None = None, ) -> None: self.id: int | None = xkcd_dict.get("num") self.date: datetime.date | None = self._determine_date(xkcd_dict) @@ -104,9 +104,9 @@ class Comic: class Client: def __init__( - self, - api_url: str = "https://xkcd.com", - explanation_wiki_url: str = "https://www.explainxkcd.com/wiki/index.php/", + self, + api_url: str = "https://xkcd.com", + explanation_wiki_url: str = "https://www.explainxkcd.com/wiki/index.php/", ) -> None: self._api_url = api_url self._explanation_wiki_url = explanation_wiki_url diff --git a/services/xp_service.py b/services/xp_service.py index 855d018..8cf7b31 100644 --- a/services/xp_service.py +++ b/services/xp_service.py @@ -132,9 +132,9 @@ class XpService: @staticmethod def generate_progress_bar( - current_value: int, - target_value: int, - bar_length: int = 10, + current_value: int, + target_value: int, + bar_length: int = 10, ) -> str: """ Generates an XP progress bar based on the current level and XP.