diff --git a/telethon/__init__.py b/telethon/__init__.py index 92295238..f0d2b0b8 100644 --- a/telethon/__init__.py +++ b/telethon/__init__.py @@ -2,10 +2,11 @@ import logging from .client.telegramclient import TelegramClient from .network import connection from .tl import types, functions, custom -from . import version, events, utils +from . import version, events, utils, errors __version__ = version.__version__ logging.getLogger(__name__).addHandler(logging.NullHandler()) -__all__ = ['TelegramClient', 'types', 'functions', 'custom', 'events', 'utils'] +__all__ = ['TelegramClient', 'types', 'functions', 'custom', + 'events', 'utils', 'errors'] diff --git a/telethon_generator/data/error_descriptions b/telethon_generator/data/error_descriptions index 8d7cf7ee..6e840d65 100644 --- a/telethon_generator/data/error_descriptions +++ b/telethon_generator/data/error_descriptions @@ -64,4 +64,5 @@ USER_ALREADY_PARTICIPANT=The authenticated user is already a participant of the USER_DEACTIVATED=The user has been deleted/deactivated FLOOD_WAIT_X=A wait of {} seconds is required FLOOD_TEST_PHONE_WAIT_X=A wait of {} seconds is required in the test servers -CHAT_NOT_MODIFIED=The chat or channel wasn't modified (title, invites, username, admins, etc. are the same).รง +TAKEOUT_INIT_DELAY_X=A wait of {} seconds is required before being able to initiate the takeout +CHAT_NOT_MODIFIED=The chat or channel wasn't modified (title, invites, username, admins, etc. are the same) diff --git a/telethon_generator/parsers/errors.py b/telethon_generator/parsers/errors.py index d5e53eda..8f8ac36c 100644 --- a/telethon_generator/parsers/errors.py +++ b/telethon_generator/parsers/errors.py @@ -28,6 +28,7 @@ KNOWN_CODES = { CAPTURE_NAMES = { 'FloodWaitError': 'seconds', 'FloodTestPhoneWaitError': 'seconds', + 'TakeoutInitDelayError': 'seconds', 'FileMigrateError': 'new_dc', 'NetworkMigrateError': 'new_dc', 'PhoneMigrateError': 'new_dc', @@ -97,7 +98,7 @@ def parse_errors(json_file, descriptions_file): # PWRTelegram's API doesn't return all errors, which we do need here. # Add some special known-cases manually first. errors[420].update(( - 'FLOOD_WAIT_X', 'FLOOD_TEST_PHONE_WAIT_X' + 'FLOOD_WAIT_X', 'FLOOD_TEST_PHONE_WAIT_X', 'TAKEOUT_INIT_DELAY_X' )) errors[401].update(( 'AUTH_KEY_INVALID', 'SESSION_EXPIRED', 'SESSION_REVOKED'