Add use_test_servers

This commit is contained in:
blank X 2021-10-10 17:07:44 +07:00
parent 4d2b2c65eb
commit 7f091ce6c9
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ telegram:
api_id: 0 api_id: 0
api_hash: https://my.telegram.org api_hash: https://my.telegram.org
slave_bot_token: https://t.me/BotFather slave_bot_token: https://t.me/BotFather
use_test_servers: false
config: config:
prefixes: prefixes:
- . - .

View File

@ -31,10 +31,10 @@ class Parser(parser.Parser):
return text return text
return await super().parse(text, mode) return await super().parse(text, mode)
for session_name in config['config']['sessions']: 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) app.parser = Parser(app)
apps.append(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) slave.parser = Parser(slave)
session = aiohttp.ClientSession() session = aiohttp.ClientSession()