From a3dc002b9ac79399851acf2dfe2b4df35d89bbe9 Mon Sep 17 00:00:00 2001 From: afolivieri Date: Fri, 11 Oct 2024 16:00:40 +0300 Subject: [PATCH] Restructured code in regex matching for better performance --- streaming_overseer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/streaming_overseer.py b/streaming_overseer.py index 29c9c9f..2796613 100644 --- a/streaming_overseer.py +++ b/streaming_overseer.py @@ -7,7 +7,6 @@ from telethon import TelegramClient, events import logging import traceback import platform -import sys # Configuration files CREDENTIALS_FILE = 'credentials.json' @@ -128,7 +127,7 @@ async def main(): start_pos = max(match.start() - 20, 0) end_pos = min(match.end() + 20, len(message_content)) context = message_content[start_pos:end_pos] - await client.send_message(channel_id, f"Keyword Match: {word}\nContext: {context}") + await client.send_message(channel_id, f"Keyword Match from {event.chat.title}: {word}\nContext: {context}") await asyncio.sleep(0.1) await event.message.forward_to(channel_id) await asyncio.sleep(0.5)