fix welcome message

Kaveen Kumarasinghe 2 years ago
parent 28d04d5753
commit 0adb5c0e38

@ -17,8 +17,6 @@ from collections import defaultdict
original_message = {} original_message = {}
ALLOWED_GUILDS = EnvService.get_allowed_guilds() ALLOWED_GUILDS = EnvService.get_allowed_guilds()
print("THE ALLOWED GUILDS ARE: ", ALLOWED_GUILDS)
class GPT3ComCon(commands.Cog, name="GPT3ComCon"): class GPT3ComCon(commands.Cog, name="GPT3ComCon"):
def __init__( def __init__(
@ -100,10 +98,10 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"):
query = f"Please generate a welcome message for {member.name} who has just joined the server." query = f"Please generate a welcome message for {member.name} who has just joined the server."
try: try:
welcome_message = self.model.send_request( welcome_message_response = await self.model.send_request(
query, tokens=self.usage_service.count_tokens(query) query, tokens=self.usage_service.count_tokens(query)
) )
welcome_message = str(welcome_message_response["choices"][0]["text"])
except: except:
welcome_message = None welcome_message = None
@ -112,6 +110,7 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"):
welcome_embed = discord.Embed( welcome_embed = discord.Embed(
title=f"Welcome, {member.name}!", description=welcome_message title=f"Welcome, {member.name}!", description=welcome_message
) )
welcome_embed.add_field( welcome_embed.add_field(
name="Just so you know...", name="Just so you know...",
value="> My commands are invoked with a forward slash (/)\n> Use /help to see my help message(s).", value="> My commands are invoked with a forward slash (/)\n> Use /help to see my help message(s).",
@ -860,6 +859,7 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"):
"num_images", "num_images",
"summarize_conversations", "summarize_conversations",
"summarize_threshold", "summarize_threshold",
"welcome_message_enabled",
"IMAGE_SAVE_PATH", "IMAGE_SAVE_PATH",
], ],
) )

@ -53,7 +53,7 @@ class Model:
self._summarize_conversations = True self._summarize_conversations = True
self._summarize_threshold = 2500 self._summarize_threshold = 2500
self.model_max_tokens = 4024 self.model_max_tokens = 4024
self._welcome_message_enabled = False self._welcome_message_enabled = True
try: try:
self.IMAGE_SAVE_PATH = os.environ["IMAGE_SAVE_PATH"] self.IMAGE_SAVE_PATH = os.environ["IMAGE_SAVE_PATH"]

Loading…
Cancel
Save