diff --git a/cogs/gpt_3_commands_and_converser.py b/cogs/gpt_3_commands_and_converser.py index e135761..ded352c 100644 --- a/cogs/gpt_3_commands_and_converser.py +++ b/cogs/gpt_3_commands_and_converser.py @@ -98,13 +98,21 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"): async def on_member_join(self, member): if self.welcome_message_enabled(): query = f"Please generate a welcome message for {member.name} who has just joined the server." - welcome_message = self.model.send_request(query, tokens=self.usage_service.count_tokens(query)) + welcome_message = self.model.send_request( + query, tokens=self.usage_service.count_tokens(query) + ) if not welcome_message: welcome_message = EnvService.get_welcome_message() - welcome_embed = discord.Embed(title=f"Welcome, {member.name}!", description=welcome_message) - welcome_embed.add_field(name="Just so you know...", value="> My commands are invoked with a forward slash ("/")\n> Use /help to see my help message(s).") + welcome_embed = discord.Embed( + title=f"Welcome, {member.name}!", description=welcome_message + ) + welcome_embed.add_field( + name="Just so you know...", + value="> My commands are invoked with a forward slash (" + / ")\n> Use /help to see my help message(s).", + ) await member.send(content=None, embed=welcome_embded) - + @commands.Cog.listener() async def on_member_remove(self, member): pass diff --git a/models/env_service_model.py b/models/env_service_model.py index c796707..cf94c9e 100644 --- a/models/env_service_model.py +++ b/models/env_service_model.py @@ -53,12 +53,12 @@ class EnvService: allowed_roles.split(",") if "," in allowed_roles else [allowed_roles] ) return allowed_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. - #The string can be blank but this is not advised. If a string cannot be found in the .env file, the below string is used. - #The string is DMd to the new server member as part of an embed. + # The string can be blank but this is not advised. If a string cannot be found in the .env file, the below string is used. + # The string is DMd to the new server member as part of an embed. try: welcome_message = os.getenv("WELCOME_MESSAGE") except: diff --git a/models/openai_model.py b/models/openai_model.py index 39fb535..71c61a7 100644 --- a/models/openai_model.py +++ b/models/openai_model.py @@ -78,7 +78,7 @@ class Model: self.openai_key = os.getenv("OPENAI_TOKEN") # Use the @property and @setter decorators for all the self fields to provide value checking - + @property def welcome_message_enabled(self): return self.send_welcome_message @@ -91,8 +91,7 @@ class Model: self.send_welcome_message = False else: raise ValueError("Value must be either true or false!") - - + @property def summarize_threshold(self): return self._summarize_threshold