refactor
This commit is contained in:
@ -4,25 +4,10 @@ from pathlib import Path
|
||||
from typing import Self
|
||||
|
||||
from telethon import TelegramClient
|
||||
from telethon.errors import UserDeactivatedBanError, UserDeactivatedError
|
||||
from telethon.sessions import StringSession
|
||||
|
||||
TelethonBannedError = (UserDeactivatedError, UserDeactivatedBanError)
|
||||
|
||||
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: "",
|
||||
}
|
||||
from .consts import API_PACKS
|
||||
from .exceptions import ThonBannedError
|
||||
|
||||
|
||||
class BaseData:
|
||||
@ -175,7 +160,7 @@ class BaseThon(BaseData):
|
||||
except ConnectionError:
|
||||
await self.disconnect()
|
||||
return "ERROR_AUTH:CONNECTION_ERROR"
|
||||
except TelethonBannedError:
|
||||
except ThonBannedError:
|
||||
await self.disconnect()
|
||||
return "ERROR_AUTH:BAN_ERROR"
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user