Пример #1
0
def gen_tl():
    from telethon_generator.tl_generator import TLGenerator
    generator = TLGenerator('telethon/tl')
    if generator.tlobjects_exist():
        print('Detected previous TLObjects. Cleaning...')
        generator.clean_tlobjects()

    print('Generating TLObjects...')
    generator.generate_tlobjects('telethon_generator/scheme.tl',
                                 import_depth=2)
    print('Done.')
Пример #2
0
def gen_tl():
    from telethon_generator.tl_generator import TLGenerator
    from telethon_generator.error_generator import generate_code
    generator = TLGenerator(GENERATOR_DIR)
    if generator.tlobjects_exist():
        print('Detected previous TLObjects. Cleaning...')
        generator.clean_tlobjects()

    print('Generating TLObjects...')
    generator.generate_tlobjects(SCHEME_TL, import_depth=IMPORT_DEPTH)
    print('Generating errors...')
    generate_code(ERROR_LIST, json_file=ERRORS_JSON, errors_desc=ERRORS_DESC)
    print('Done.')
Пример #3
0
try:
    from telethon import TelegramClient
except ImportError:
    TelegramClient = None

if __name__ == '__main__':
    if len(argv) >= 2 and argv[1] == 'gen_tl':
        from telethon_generator.tl_generator import TLGenerator
        generator = TLGenerator('telethon/tl')
        if generator.tlobjects_exist():
            print('Detected previous TLObjects. Cleaning...')
            generator.clean_tlobjects()

        print('Generating TLObjects...')
        generator.generate_tlobjects('telethon_generator/scheme.tl',
                                     import_depth=2)
        print('Done.')

    elif len(argv) >= 2 and argv[1] == 'clean_tl':
        from telethon_generator.tl_generator import TLGenerator
        print('Cleaning...')
        TLGenerator('telethon/tl').clean_tlobjects()
        print('Done.')

    else:
        if not TelegramClient:
            print('Run `python3', argv[0], 'gen_tl` first.')
            quit()

        here = path.abspath(path.dirname(__file__))
Пример #4
0
    from telethon import TelegramClient
except ImportError:
    TelegramClient = None


if __name__ == '__main__':
    if len(argv) >= 2 and argv[1] == 'gen_tl':
        from telethon_generator.tl_generator import TLGenerator
        generator = TLGenerator('telethon/tl')
        if generator.tlobjects_exist():
            print('Detected previous TLObjects. Cleaning...')
            generator.clean_tlobjects()

        print('Generating TLObjects...')
        generator.generate_tlobjects(
            'telethon_generator/scheme.tl', import_depth=2
        )
        print('Done.')

    elif len(argv) >= 2 and argv[1] == 'clean_tl':
        from telethon_generator.tl_generator import TLGenerator
        print('Cleaning...')
        TLGenerator('telethon/tl').clean_tlobjects()
        print('Done.')

    else:
        if not TelegramClient:
            print('Run `python3', argv[0], 'gen_tl` first.')
            quit()

        here = path.abspath(path.dirname(__file__))