refactor TelegramClient: remove disconnection handler and related exit logic
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user