diff --git a/main.py b/main.py index 2d11352..30455bc 100644 --- a/main.py +++ b/main.py @@ -85,9 +85,9 @@ async def on_message(message: discord.Message): for arg in arguments.keys(): bprompt = bprompt.replace(f'|{arg}|', arguments[arg]) + c = db.cursor() if message.author not in cached_conversations: cached_conversations[message.author] = copeai_backend.conversation.Conversation() - c = db.cursor() c.execute('SELECT * FROM message_history WHERE user_id = ? ORDER BY timestamp DESC', (message.author.id,)) msgs = c.fetchall() message_token_usage = num_tokens_from_string(message.content)