Skip to content

Commit

Permalink
Add system_lang_code to Client and missing enums to SentCodeType (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
ke1io committed Feb 19, 2024
1 parent f783c77 commit 40ddcbc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pyrogram/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class Client(Methods):
Code of the language used on the client, in ISO 639-1 standard.
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*):
Pass True to connect to Telegram using IPv6.
Defaults to False (IPv4).
Expand Down Expand Up @@ -193,6 +197,7 @@ class Client(Methods):

LANG_PACK = ""
LANG_CODE = "en"
SYSTEM_LANG_CODE = "en"

PARENT_DIR = Path(sys.argv[0]).parent

Expand All @@ -218,6 +223,7 @@ def __init__(
system_version: str = SYSTEM_VERSION,
lang_pack: str = LANG_PACK,
lang_code: str = LANG_CODE,
system_lang_code: str = SYSTEM_LANG_CODE,
ipv6: bool = False,
proxy: dict = None,
test_mode: bool = False,
Expand Down Expand Up @@ -248,6 +254,7 @@ def __init__(
self.system_version = system_version
self.lang_pack = lang_pack.lower()
self.lang_code = lang_code.lower()
self.system_lang_code = system_lang_code.lower()
self.ipv6 = ipv6
self.proxy = proxy
self.test_mode = test_mode
Expand Down
6 changes: 6 additions & 0 deletions pyrogram/enums/sent_code_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ class SentCodeType(AutoName):

EMAIL_CODE = raw.types.auth.SentCodeTypeEmailCode
"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."
2 changes: 1 addition & 1 deletion pyrogram/session/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async def start(self):
app_version=self.client.app_version,
device_model=self.client.device_model,
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_code=self.client.lang_code,
query=raw.functions.help.GetConfig(),
Expand Down
2 changes: 1 addition & 1 deletion pyrogram/storage/file_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
log = logging.getLogger(__name__)

SCHEMA = """
CREATE TABLE usernames
CREATE TABLE IF NOT EXISTS usernames
(
id INTEGER,
username TEXT,
Expand Down

0 comments on commit 40ddcbc

Please sign in to comment.