From 7f091ce6c917d1c06a38f4efbd99cdb029c69893 Mon Sep 17 00:00:00 2001 From: blank X Date: Sun, 10 Oct 2021 17:07:44 +0700 Subject: [PATCH] Add use_test_servers --- example-config.yaml | 1 + sukuinote/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/example-config.yaml b/example-config.yaml index d21cb34..648cb1c 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -2,6 +2,7 @@ telegram: api_id: 0 api_hash: https://my.telegram.org slave_bot_token: https://t.me/BotFather + use_test_servers: false config: prefixes: - . diff --git a/sukuinote/__init__.py b/sukuinote/__init__.py index 80414b4..0659289 100644 --- a/sukuinote/__init__.py +++ b/sukuinote/__init__.py @@ -31,10 +31,10 @@ class Parser(parser.Parser): return text return await super().parse(text, mode) for session_name in config['config']['sessions']: - app = Client(session_name, api_id=config['telegram']['api_id'], api_hash=config['telegram']['api_hash'], plugins={'root': os.path.join(__package__, 'plugins')}, parse_mode='html', workdir='sessions') + app = Client(session_name, api_id=config['telegram']['api_id'], api_hash=config['telegram']['api_hash'], plugins={'root': os.path.join(__package__, 'plugins')}, parse_mode='html', workdir='sessions', test_mode=config['telegram'].get('use_test_servers', False)) app.parser = Parser(app) apps.append(app) -slave = Client('sukuinote-slave', api_id=config['telegram']['api_id'], api_hash=config['telegram']['api_hash'], plugins={'root': os.path.join(__package__, 'slave-plugins')}, parse_mode='html', bot_token=config['telegram']['slave_bot_token'], workdir='sessions') +slave = Client('sukuinote-slave', api_id=config['telegram']['api_id'], api_hash=config['telegram']['api_hash'], plugins={'root': os.path.join(__package__, 'slave-plugins')}, parse_mode='html', bot_token=config['telegram']['slave_bot_token'], workdir='sessions', test_mode=config['telegram'].get('use_test_servers', False)) slave.parser = Parser(slave) session = aiohttp.ClientSession()