From dc3abeb4297c19faae4c668137b2a4b70c907f87 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Wed, 19 Feb 2025 16:41:05 +0100 Subject: [PATCH] Fix --- src/modules/stream_notifications/messages_proc.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/stream_notifications/messages_proc.py b/src/modules/stream_notifications/messages_proc.py index f550881..867b6cc 100644 --- a/src/modules/stream_notifications/messages_proc.py +++ b/src/modules/stream_notifications/messages_proc.py @@ -154,8 +154,12 @@ class MessagesProc: def get_message_history_with_thread(cls, message_id: str, thread_id: str | None = None) -> list[dict]: logger.info(f"HISTORY: {cls.MESSAGE_HISTORY}") - return [m for m in cls.MESSAGE_HISTORY if m["thread_id"] == thread_id] + \ - [m for m in cls.MESSAGE_HISTORY if m["id"] == message_id] + if thread_id is not None: + thread_messages = [m for m in cls.MESSAGE_HISTORY if m["thread_id"] == thread_id] + else: + thread_messages = [] + + return thread_messages + [m for m in cls.MESSAGE_HISTORY if m["id"] == message_id] @classmethod async def on_message(cls, event: MessageEvent):