Add system_lang_code to Client and missing enums to SentCodeType (#27)

This commit is contained in:
Gor 2024-02-20 02:27:00 +04:00 committed by GitHub
parent f783c77368
commit 40ddcbca60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 2 deletions

View File

@ -96,6 +96,10 @@ class Client(Methods):
Code of the language used on the client, in ISO 639-1 standard. Code of the language used on the client, in ISO 639-1 standard.
Defaults to "en". Defaults to "en".
system_lang_code (``str``, *optional*):
Code of the language used on the system, in ISO 639-1 standard.
Defaults to "en".
ipv6 (``bool``, *optional*): ipv6 (``bool``, *optional*):
Pass True to connect to Telegram using IPv6. Pass True to connect to Telegram using IPv6.
Defaults to False (IPv4). Defaults to False (IPv4).
@ -193,6 +197,7 @@ class Client(Methods):
LANG_PACK = "" LANG_PACK = ""
LANG_CODE = "en" LANG_CODE = "en"
SYSTEM_LANG_CODE = "en"
PARENT_DIR = Path(sys.argv[0]).parent PARENT_DIR = Path(sys.argv[0]).parent
@ -218,6 +223,7 @@ class Client(Methods):
system_version: str = SYSTEM_VERSION, system_version: str = SYSTEM_VERSION,
lang_pack: str = LANG_PACK, lang_pack: str = LANG_PACK,
lang_code: str = LANG_CODE, lang_code: str = LANG_CODE,
system_lang_code: str = SYSTEM_LANG_CODE,
ipv6: bool = False, ipv6: bool = False,
proxy: dict = None, proxy: dict = None,
test_mode: bool = False, test_mode: bool = False,
@ -248,6 +254,7 @@ class Client(Methods):
self.system_version = system_version self.system_version = system_version
self.lang_pack = lang_pack.lower() self.lang_pack = lang_pack.lower()
self.lang_code = lang_code.lower() self.lang_code = lang_code.lower()
self.system_lang_code = system_lang_code.lower()
self.ipv6 = ipv6 self.ipv6 = ipv6
self.proxy = proxy self.proxy = proxy
self.test_mode = test_mode self.test_mode = test_mode

View File

@ -43,3 +43,9 @@ class SentCodeType(AutoName):
EMAIL_CODE = raw.types.auth.SentCodeTypeEmailCode EMAIL_CODE = raw.types.auth.SentCodeTypeEmailCode
"The code was sent via email." "The code was sent via email."
FIREBASE_SMS = raw.types.auth.SentCodeTypeFirebaseSms
"The code should be delivered via SMS after Firebase attestation."
SETUP_EMAIL_REQUIRED = raw.types.auth.SentCodeTypeSetUpEmailRequired
"The user should add and verify an email address in order to login."

View File

@ -125,7 +125,7 @@ class Session:
app_version=self.client.app_version, app_version=self.client.app_version,
device_model=self.client.device_model, device_model=self.client.device_model,
system_version=self.client.system_version, system_version=self.client.system_version,
system_lang_code=self.client.lang_code, system_lang_code=self.client.system_lang_code,
lang_pack=self.client.lang_pack, lang_pack=self.client.lang_pack,
lang_code=self.client.lang_code, lang_code=self.client.lang_code,
query=raw.functions.help.GetConfig(), query=raw.functions.help.GetConfig(),

View File

@ -26,7 +26,7 @@ from .sqlite_storage import SQLiteStorage
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
SCHEMA = """ SCHEMA = """
CREATE TABLE usernames CREATE TABLE IF NOT EXISTS usernames
( (
id INTEGER, id INTEGER,
username TEXT, username TEXT,