mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
25 lines
772 B
Python
25 lines
772 B
Python
from telethon_generator.parsers import parse_errors, parse_tl, find_layer
|
|
from telethon_generator.generators import generate_errors, generate_tlobjects
|
|
|
|
|
|
ERRORS_INPUT_JSON = 'data/errors.json'
|
|
ERRORS_INPUT_DESC = 'data/error_descriptions'
|
|
ERRORS_OUTPUT = '../telethon/errors/rpc_error_list.py'
|
|
|
|
TLOBJECT_INPUT_TL = 'data/scheme.tl'
|
|
TLOBJECT_OUTPUT = '../telethon/tl'
|
|
|
|
|
|
if __name__ == '__main__':
|
|
generate_tlobjects(
|
|
tlobjects=list(parse_tl(TLOBJECT_INPUT_TL, ignore_core=True)),
|
|
layer=find_layer((TLOBJECT_INPUT_TL)),
|
|
output_dir=TLOBJECT_OUTPUT
|
|
)
|
|
|
|
with open(ERRORS_OUTPUT, 'w', encoding='utf-8') as file:
|
|
generate_errors(
|
|
errors=list(parse_errors(ERRORS_INPUT_JSON, ERRORS_INPUT_DESC)),
|
|
f=file
|
|
)
|