diff --git a/cogs/gpt_3_commands_and_converser.py b/cogs/gpt_3_commands_and_converser.py index 2620a85..600e9a2 100644 --- a/cogs/gpt_3_commands_and_converser.py +++ b/cogs/gpt_3_commands_and_converser.py @@ -16,7 +16,6 @@ from collections import defaultdict original_message = {} ALLOWED_GUILDS = EnvService.get_allowed_guilds() -WELCOME_MESSAGE = EnvService.get_welcome_message() class GPT3ComCon(commands.Cog, name="GPT3ComCon"): @@ -92,9 +91,14 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"): @commands.Cog.listener() async def on_member_join(self, member): - 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 messages.") - await member.send(content=None, embed=welcome_embded) + if self.welcome_message_enabled(): + query = f"Please generate a welcome message for {member.name} who has just joined the server." + welcome_message = self.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).") + await member.send(content=None, embed=welcome_embded) @commands.Cog.listener() async def on_member_remove(self, member):