From 629bce7576e26687e8760e3e60dc89824cd38a6f Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 19 Mar 2023 19:50:32 -0600 Subject: [PATCH] t --- matrix_gpt/bot/callbacks.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/matrix_gpt/bot/callbacks.py b/matrix_gpt/bot/callbacks.py index e9cddfd..b21a34e 100644 --- a/matrix_gpt/bot/callbacks.py +++ b/matrix_gpt/bot/callbacks.py @@ -75,7 +75,10 @@ class Callbacks: return if event.server_timestamp < self.startup_ts: - logger.info(f'Skipping event as it was sent before startup time: {event.event_id}') + logger.debug(f'Skipping event as it was sent before startup time: {event.event_id}') + return + if self.store.check_seen_event(event.event_id): + logger.debug(f'Skipping seen event: {event.event_id}') return # if room.member_count > 2: @@ -88,7 +91,7 @@ class Callbacks: # room.member_count > 2 ... we assume a public room # room.member_count <= 2 ... we assume a DM # General message listener - if not msg.startswith(f'{self.command_prefix} ') and is_thread(event) and not self.store.check_seen_event(event.event_id) and (await is_this_our_thread(self.client, room, event, self.command_prefix)): + if not msg.startswith(f'{self.command_prefix} ') and is_thread(event) and (await is_this_our_thread(self.client, room, event, self.command_prefix)): await self.client.room_typing(room.room_id, typing_state=True, timeout=3000) thread_content = await get_thread_content(self.client, room, event) api_data = [] @@ -107,8 +110,6 @@ class Callbacks: 'content': thread_msg if not thread_msg.startswith(self.command_prefix) else thread_msg[len(self.command_prefix):].strip() }) # if len(thread_content) >= 2 and thread_content[0].body.startswith(self.command_prefix): # if thread_content[len(thread_content) - 2].sender == self.client.user - logger.info(thread_content[0].event_id) - # TODO: process_chat() will set typing as false after generating. # TODO: If there is still another query in-progress that typing state will be overwritten by the one that just finished. async def inner():