Changed welcome message to query GPT3 for new msg

Welcome messages are now generated by GPT3 or default to one stored in env variable if GPT3 in unavailable.
Karl 2 years ago committed by GitHub
parent 357422414a
commit f30c9f07e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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):

Loading…
Cancel
Save