refactor TelegramClient: remove disconnection handler and related exit logic

This commit is contained in:
vvzvlad
2025-04-30 14:39:09 +04:00
parent 1ec87cba14
commit 740104bb7b
-7
View File
@@ -44,15 +44,8 @@ class TelegramClient:
def _setup_connection_handlers(self):
"""Sets up connection/disconnection handlers"""
self.client.add_handler(DisconnectHandler(self._on_disconnect))
logger.info("connection_handlers: connection handlers set up")
async def _on_disconnect(self, _client):
"""Handles disconnection by just exiting the program"""
logger.error("connection_handler: connection lost, terminating program")
# Force exit with error code
sys.exit(1)
async def start(self):
try:
if not self.client.is_connected: