From 20c0e8b8d590b2caf12f3c97d31527297222943e Mon Sep 17 00:00:00 2001 From: afolivieri Date: Fri, 11 Oct 2024 12:14:05 +0300 Subject: [PATCH] updated content match message with all possible matches and contextes --- streaming_overseer.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/streaming_overseer.py b/streaming_overseer.py index 7144662..c1af354 100644 --- a/streaming_overseer.py +++ b/streaming_overseer.py @@ -132,11 +132,13 @@ async def main(): context = message_content[start_pos:end_pos] words.append(word) contexts.append(context) - await client.send_message(channel_id, f"Keyword Match: {', '.join(words)}\nContext: {', '.join(contexts)}") - await asyncio.sleep(0.1) - await event.message.forward_to(channel_id) - await asyncio.sleep(0.5) - print(f'Forwarded Message: {message_content}') + break + if words: + await client.send_message(channel_id, f"Keyword Match: {', '.join(words)}\nContext: {', '.join(contexts)}") + await asyncio.sleep(0.1) + await event.message.forward_to(channel_id) + await asyncio.sleep(0.5) + print(f'Forwarded Message: {message_content}') except Exception as e: logging.error(f"Error in message handler: {e}")