refactor
This commit is contained in:
@ -4,25 +4,10 @@ from pathlib import Path
|
|||||||
from typing import Self
|
from typing import Self
|
||||||
|
|
||||||
from telethon import TelegramClient
|
from telethon import TelegramClient
|
||||||
from telethon.errors import UserDeactivatedBanError, UserDeactivatedError
|
|
||||||
from telethon.sessions import StringSession
|
from telethon.sessions import StringSession
|
||||||
|
|
||||||
TelethonBannedError = (UserDeactivatedError, UserDeactivatedBanError)
|
from .consts import API_PACKS
|
||||||
|
from .exceptions import ThonBannedError
|
||||||
API_PACKS = {
|
|
||||||
4: "android",
|
|
||||||
5: "android",
|
|
||||||
6: "android",
|
|
||||||
8: "ios",
|
|
||||||
9: "macos",
|
|
||||||
2834: "macos",
|
|
||||||
2040: "tdesktop",
|
|
||||||
10840: "ios",
|
|
||||||
17349: "tdesktop",
|
|
||||||
21724: "android",
|
|
||||||
16623: "android",
|
|
||||||
2496: "",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class BaseData:
|
class BaseData:
|
||||||
@ -175,7 +160,7 @@ class BaseThon(BaseData):
|
|||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
return "ERROR_AUTH:CONNECTION_ERROR"
|
return "ERROR_AUTH:CONNECTION_ERROR"
|
||||||
except TelethonBannedError:
|
except ThonBannedError:
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
return "ERROR_AUTH:BAN_ERROR"
|
return "ERROR_AUTH:BAN_ERROR"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user