diff --git a/basethon/base_thon.py b/basethon/base_thon.py index 1aff158..67944f1 100644 --- a/basethon/base_thon.py +++ b/basethon/base_thon.py @@ -8,7 +8,7 @@ from telethon.sessions import StringSession from telethon.tl.functions.account import UpdateStatusRequest from telethon.tl.functions.help import GetCountriesListRequest, GetNearestDcRequest from telethon.tl.functions.langpack import GetLangPackRequest -from telethon.types import JsonNumber, JsonObject, JsonObjectValue +from telethon.types import JsonNumber, JsonObject, JsonObjectValue, JsonString from .consts import API_PACKS from .exceptions import ThonBannedError @@ -118,9 +118,10 @@ class BaseData: return proxy @property - def tz_offset(self) -> int | None: - if tz_offset := self.json_data.get("tz_offset"): + def tz_offset(self) -> int: + if tz_offset := self.json_data.get("tz_offset", 0): return tz_offset + return 0 class BaseThon(BaseData): @@ -155,11 +156,26 @@ class BaseThon(BaseData): proxy=self.proxy, timeout=self.__timeout, ) - if self.tz_offset: - tz_offset = JsonObjectValue("tz_offset", JsonNumber(self.tz_offset)) - client._init_request.params = JsonObject([tz_offset]) - client._init_request.lang_pack = API_PACKS.get(self.app_id, "android") + installer = JsonObjectValue("installer", JsonString("com.android.vending")) + if self.app_id in (1, 8): + installer = JsonObjectValue("installer", JsonString("com.apple.AppStore")) + package = JsonObjectValue("package_id", JsonString("org.telegram.messenger")) + if self.app_id in (1, 8): + package = JsonObjectValue("package_id", JsonString("ph.telegra.Telegraph")) + + perf_cat = JsonObjectValue("perf_cat", JsonNumber(2)) + tz_offset = JsonObjectValue("tz_offset", JsonNumber(self.tz_offset)) + if self.tz_offset: + client._init_request.params = JsonObject([tz_offset]) + + if self.app_id in (4, 6): + _list = [installer, package, perf_cat] + if self.tz_offset: + _list.append(tz_offset) + client._init_request.params = JsonObject(_list) + + client._init_request.lang_pack = API_PACKS.get(self.app_id, "android") return client async def get_additional_data(self):