From d6a770e01141db129f67971c0c94f9e7ce8a4288 Mon Sep 17 00:00:00 2001 From: Dory Date: Thu, 21 Aug 2025 00:21:02 -0700 Subject: [PATCH] refactor and add last_messages --- bot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index c8f603d..0b5d858 100644 --- a/bot.py +++ b/bot.py @@ -104,9 +104,7 @@ class Conversation: ) response = llm_response.choices[0].message.content self.add_message_pair(openai_content, response) - - # Split into chunks for discord to prevent message too long - return [response[i:i+2000] for i in range(0, len(response), 2000)] + return response # --- Data Storage --- @@ -151,7 +149,9 @@ async def on_message(message): try: async with channel.typing(): - chunks = await conversation.send(user_message, media) + response = await conversation.send(user_message, media) + # Split into chunks for discord to prevent message too long + return [response[i:i+2000] for i in range(0, len(response), 2000)] conversation.last_messages = [] for chunk in chunks: if channel.guild: