From ab3d0a68680427e74e78458de173109318b78ffe Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Tue, 3 Jan 2023 00:57:04 +0000 Subject: [PATCH] Format Python code with psf/black push --- cogs/draw_image_generation.py | 1 + cogs/gpt_3_commands_and_converser.py | 35 +++++++++++++++------------- cogs/image_prompt_optimizer.py | 2 +- models/check_model.py | 5 +++- models/env_service_model.py | 13 +++++++---- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/cogs/draw_image_generation.py b/cogs/draw_image_generation.py index 4ca0721..bb7fb11 100644 --- a/cogs/draw_image_generation.py +++ b/cogs/draw_image_generation.py @@ -146,6 +146,7 @@ class DrawDallEService(discord.Cog, name="DrawDallEService"): self.converser_cog.users_to_interactions[user_id].append( result_message.id ) + @add_to_group("dalle") @discord.slash_command( name="draw", diff --git a/cogs/gpt_3_commands_and_converser.py b/cogs/gpt_3_commands_and_converser.py index 4f9abe8..c052de2 100644 --- a/cogs/gpt_3_commands_and_converser.py +++ b/cogs/gpt_3_commands_and_converser.py @@ -94,21 +94,24 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): self.conversation_threads = {} # Create slash command groups - dalle = discord.SlashCommandGroup(name="dalle", - description="Dalle related commands", - guild_ids=ALLOWED_GUILDS, - checks=[Check.check_dalle_roles()] - ) - gpt = discord.SlashCommandGroup(name="gpt", - description="GPT related commands", - guild_ids=ALLOWED_GUILDS, - checks=[Check.check_gpt_roles()] - ) - system = discord.SlashCommandGroup(name="system", - description="Admin/System settings for the bot", - guild_ids=ALLOWED_GUILDS, - checks=[Check.check_admin_roles()] - ) + dalle = discord.SlashCommandGroup( + name="dalle", + description="Dalle related commands", + guild_ids=ALLOWED_GUILDS, + checks=[Check.check_dalle_roles()], + ) + gpt = discord.SlashCommandGroup( + name="gpt", + description="GPT related commands", + guild_ids=ALLOWED_GUILDS, + checks=[Check.check_gpt_roles()], + ) + system = discord.SlashCommandGroup( + name="system", + description="Admin/System settings for the bot", + guild_ids=ALLOWED_GUILDS, + checks=[Check.check_admin_roles()], + ) @commands.Cog.listener() async def on_member_join(self, member): @@ -154,7 +157,7 @@ class GPT3ComCon(discord.Cog, name="GPT3ComCon"): delete_existing=True, ) print(f"The debug channel was acquired and commands registered") - + @add_to_group("system") @discord.slash_command( name="set-usage", diff --git a/cogs/image_prompt_optimizer.py b/cogs/image_prompt_optimizer.py index 56ce84b..c42ef25 100644 --- a/cogs/image_prompt_optimizer.py +++ b/cogs/image_prompt_optimizer.py @@ -45,7 +45,7 @@ class ImgPromptOptimizer(discord.Cog, name="ImgPromptOptimizer"): except: traceback.print_exc() self.OPTIMIZER_PRETEXT = self._OPTIMIZER_PRETEXT - + @add_to_group("dalle") @discord.slash_command( name="imgoptimize", diff --git a/models/check_model.py b/models/check_model.py index 2a3e593..f9b2e74 100644 --- a/models/check_model.py +++ b/models/check_model.py @@ -21,6 +21,7 @@ class Check: ) return False return True + return inner def check_dalle_roles() -> Callable: @@ -34,6 +35,7 @@ class Check: ) return False return True + return inner def check_gpt_roles() -> Callable: @@ -47,4 +49,5 @@ class Check: ) return False return True - return inner \ No newline at end of file + + return inner diff --git a/models/env_service_model.py b/models/env_service_model.py index d34d102..e3bfbd5 100644 --- a/models/env_service_model.py +++ b/models/env_service_model.py @@ -50,7 +50,9 @@ class EnvService: ) admin_roles = ( - admin_roles.lower().split(",") if "," in admin_roles else [admin_roles.lower()] + admin_roles.lower().split(",") + if "," in admin_roles + else [admin_roles.lower()] ) return admin_roles @@ -72,7 +74,9 @@ class EnvService: ) dalle_roles = ( - dalle_roles.lower().split(",") if "," in dalle_roles else [dalle_roles.lower()] + dalle_roles.lower().split(",") + if "," in dalle_roles + else [dalle_roles.lower()] ) return dalle_roles @@ -94,11 +98,12 @@ class EnvService: ) gpt_roles = ( - gpt_roles.lower().strip().split(",") if "," in gpt_roles else [gpt_roles.lower()] + gpt_roles.lower().strip().split(",") + if "," in gpt_roles + else [gpt_roles.lower()] ) return gpt_roles - @staticmethod def get_welcome_message(): # WELCOME_MESSAGE is a default string used to welcome new members to the server if GPT3 is not available.