catethon 1.46.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- catethon/__init__.py +13 -0
- catethon/_updates/__init__.py +3 -0
- catethon/_updates/entitycache.py +62 -0
- catethon/_updates/messagebox.py +825 -0
- catethon/_updates/session.py +198 -0
- catethon/cat/__init__.py +36 -0
- catethon/cat/config.py +113 -0
- catethon/cat/keys/thecat-prod-rsa.pub +9 -0
- catethon/cat/proxy.py +51 -0
- catethon/cat/rsapad.py +111 -0
- catethon/cat/server.py +185 -0
- catethon/cat/session.py +85 -0
- catethon/client/__init__.py +25 -0
- catethon/client/account.py +243 -0
- catethon/client/auth.py +677 -0
- catethon/client/bots.py +72 -0
- catethon/client/buttons.py +104 -0
- catethon/client/chats.py +1336 -0
- catethon/client/dialogs.py +610 -0
- catethon/client/downloads.py +1092 -0
- catethon/client/messageparse.py +233 -0
- catethon/client/messages.py +1637 -0
- catethon/client/telegrambaseclient.py +979 -0
- catethon/client/telegramclient.py +13 -0
- catethon/client/updates.py +733 -0
- catethon/client/uploads.py +870 -0
- catethon/client/users.py +620 -0
- catethon/crypto/__init__.py +10 -0
- catethon/crypto/aes.py +111 -0
- catethon/crypto/aesctr.py +42 -0
- catethon/crypto/authkey.py +63 -0
- catethon/crypto/cdndecrypter.py +105 -0
- catethon/crypto/factorization.py +67 -0
- catethon/crypto/libssl.py +140 -0
- catethon/crypto/rsa.py +165 -0
- catethon/custom.py +1 -0
- catethon/errors/__init__.py +46 -0
- catethon/errors/common.py +180 -0
- catethon/errors/rpcbaseerrors.py +131 -0
- catethon/errors/rpcerrorlist.py +5356 -0
- catethon/events/__init__.py +140 -0
- catethon/events/album.py +343 -0
- catethon/events/callbackquery.py +346 -0
- catethon/events/chataction.py +458 -0
- catethon/events/common.py +186 -0
- catethon/events/inlinequery.py +247 -0
- catethon/events/messagedeleted.py +57 -0
- catethon/events/messageedited.py +52 -0
- catethon/events/messageread.py +143 -0
- catethon/events/newmessage.py +223 -0
- catethon/events/raw.py +53 -0
- catethon/events/userupdate.py +310 -0
- catethon/extensions/__init__.py +6 -0
- catethon/extensions/binaryreader.py +201 -0
- catethon/extensions/html.py +208 -0
- catethon/extensions/markdown.py +193 -0
- catethon/extensions/messagepacker.py +111 -0
- catethon/functions.py +1 -0
- catethon/helpers.py +436 -0
- catethon/hints.py +72 -0
- catethon/network/__init__.py +14 -0
- catethon/network/authenticator.py +212 -0
- catethon/network/connection/__init__.py +12 -0
- catethon/network/connection/connection.py +440 -0
- catethon/network/connection/http.py +39 -0
- catethon/network/connection/tcpabridged.py +33 -0
- catethon/network/connection/tcpfull.py +62 -0
- catethon/network/connection/tcpintermediate.py +46 -0
- catethon/network/connection/tcpmtproxy.py +165 -0
- catethon/network/connection/tcpobfuscated.py +62 -0
- catethon/network/mtprotoplainsender.py +56 -0
- catethon/network/mtprotosender.py +942 -0
- catethon/network/mtprotostate.py +285 -0
- catethon/network/requeststate.py +19 -0
- catethon/password.py +194 -0
- catethon/requestiter.py +134 -0
- catethon/sessions/__init__.py +4 -0
- catethon/sessions/abstract.py +172 -0
- catethon/sessions/memory.py +260 -0
- catethon/sessions/sqlite.py +385 -0
- catethon/sessions/string.py +63 -0
- catethon/sync.py +74 -0
- catethon/tl/__init__.py +1 -0
- catethon/tl/alltlobjects.py +2666 -0
- catethon/tl/core/__init__.py +26 -0
- catethon/tl/core/gzippacked.py +48 -0
- catethon/tl/core/messagecontainer.py +47 -0
- catethon/tl/core/rpcresult.py +35 -0
- catethon/tl/core/tlmessage.py +34 -0
- catethon/tl/custom/__init__.py +14 -0
- catethon/tl/custom/adminlogevent.py +475 -0
- catethon/tl/custom/button.py +347 -0
- catethon/tl/custom/chatgetter.py +150 -0
- catethon/tl/custom/conversation.py +529 -0
- catethon/tl/custom/dialog.py +172 -0
- catethon/tl/custom/draft.py +191 -0
- catethon/tl/custom/file.py +146 -0
- catethon/tl/custom/forward.py +51 -0
- catethon/tl/custom/inlinebuilder.py +450 -0
- catethon/tl/custom/inlineresult.py +176 -0
- catethon/tl/custom/inlineresults.py +83 -0
- catethon/tl/custom/inputsizedfile.py +9 -0
- catethon/tl/custom/message.py +1248 -0
- catethon/tl/custom/messagebutton.py +154 -0
- catethon/tl/custom/participantpermissions.py +138 -0
- catethon/tl/custom/qrlogin.py +119 -0
- catethon/tl/custom/sendergetter.py +102 -0
- catethon/tl/functions/__init__.py +717 -0
- catethon/tl/functions/account.py +4034 -0
- catethon/tl/functions/aicompose.py +260 -0
- catethon/tl/functions/auth.py +1057 -0
- catethon/tl/functions/bots.py +1497 -0
- catethon/tl/functions/channels.py +2254 -0
- catethon/tl/functions/chatlists.py +425 -0
- catethon/tl/functions/communities.py +359 -0
- catethon/tl/functions/contacts.py +1034 -0
- catethon/tl/functions/ephemeral.py +456 -0
- catethon/tl/functions/folders.py +44 -0
- catethon/tl/functions/fragment.py +39 -0
- catethon/tl/functions/help.py +672 -0
- catethon/tl/functions/langpack.py +178 -0
- catethon/tl/functions/messages.py +11597 -0
- catethon/tl/functions/payments.py +2917 -0
- catethon/tl/functions/phone.py +1794 -0
- catethon/tl/functions/photos.py +282 -0
- catethon/tl/functions/premium.py +188 -0
- catethon/tl/functions/smsjobs.py +180 -0
- catethon/tl/functions/stats.py +332 -0
- catethon/tl/functions/stickers.py +440 -0
- catethon/tl/functions/stories.py +1574 -0
- catethon/tl/functions/toncenter.py +75 -0
- catethon/tl/functions/updates.py +139 -0
- catethon/tl/functions/upload.py +300 -0
- catethon/tl/functions/users.py +285 -0
- catethon/tl/functions/wallet.py +928 -0
- catethon/tl/patched/__init__.py +20 -0
- catethon/tl/tlobject.py +222 -0
- catethon/tl/types/__init__.py +56275 -0
- catethon/tl/types/account.py +1501 -0
- catethon/tl/types/aicompose.py +75 -0
- catethon/tl/types/auth.py +972 -0
- catethon/tl/types/bots.py +229 -0
- catethon/tl/types/channels.py +307 -0
- catethon/tl/types/chatlists.py +276 -0
- catethon/tl/types/communities.py +135 -0
- catethon/tl/types/contacts.py +548 -0
- catethon/tl/types/ephemeral.py +66 -0
- catethon/tl/types/fragment.py +55 -0
- catethon/tl/types/help.py +1248 -0
- catethon/tl/types/messages.py +4044 -0
- catethon/tl/types/payments.py +1965 -0
- catethon/tl/types/phone.py +368 -0
- catethon/tl/types/photos.py +135 -0
- catethon/tl/types/premium.py +209 -0
- catethon/tl/types/smsjobs.py +100 -0
- catethon/tl/types/stats.py +396 -0
- catethon/tl/types/stickers.py +35 -0
- catethon/tl/types/storage.py +197 -0
- catethon/tl/types/stories.py +563 -0
- catethon/tl/types/toncenter.py +70 -0
- catethon/tl/types/updates.py +447 -0
- catethon/tl/types/upload.py +196 -0
- catethon/tl/types/users.py +191 -0
- catethon/tl/types/wallet.py +663 -0
- catethon/types.py +1 -0
- catethon/utils.py +1584 -0
- catethon/version.py +15 -0
- catethon-1.46.1.dist-info/METADATA +192 -0
- catethon-1.46.1.dist-info/RECORD +172 -0
- catethon-1.46.1.dist-info/WHEEL +4 -0
- catethon-1.46.1.dist-info/licenses/LICENSE +21 -0
- catethon-1.46.1.dist-info/licenses/NOTICE +20 -0
catethon/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .client.telegramclient import TelegramClient
|
|
2
|
+
from .network import connection
|
|
3
|
+
from .tl.custom import Button
|
|
4
|
+
from .tl import patched as _ # import for its side-effects
|
|
5
|
+
from . import version, events, utils, errors, types, functions, custom
|
|
6
|
+
|
|
7
|
+
__version__ = version.__version__
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
'TelegramClient', 'Button',
|
|
11
|
+
'types', 'functions', 'custom', 'errors',
|
|
12
|
+
'events', 'utils', 'connection'
|
|
13
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from .session import EntityType, Entity
|
|
2
|
+
from ..tl import types
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
_sentinel = object()
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class EntityCache:
|
|
9
|
+
def __init__(
|
|
10
|
+
self,
|
|
11
|
+
hash_map: dict = _sentinel,
|
|
12
|
+
self_id: int = None,
|
|
13
|
+
self_bot: bool = None
|
|
14
|
+
):
|
|
15
|
+
self.hash_map = {} if hash_map is _sentinel else hash_map
|
|
16
|
+
self.self_id = self_id
|
|
17
|
+
self.self_bot = self_bot
|
|
18
|
+
|
|
19
|
+
def set_self_user(self, id, bot, hash):
|
|
20
|
+
self.self_id = id
|
|
21
|
+
self.self_bot = bot
|
|
22
|
+
if hash:
|
|
23
|
+
self.hash_map[id] = (hash, EntityType.BOT if bot else EntityType.USER)
|
|
24
|
+
|
|
25
|
+
def get(self, id):
|
|
26
|
+
try:
|
|
27
|
+
hash, ty = self.hash_map[id]
|
|
28
|
+
return Entity(ty, id, hash)
|
|
29
|
+
except KeyError:
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
def extend(self, users, chats):
|
|
33
|
+
# See https://core.telegram.org/api/min for "issues" with "min constructors".
|
|
34
|
+
self.hash_map.update(
|
|
35
|
+
(u.id, (
|
|
36
|
+
u.access_hash,
|
|
37
|
+
EntityType.BOT if u.bot else EntityType.USER,
|
|
38
|
+
))
|
|
39
|
+
for u in users
|
|
40
|
+
if getattr(u, 'access_hash', None) and not u.min
|
|
41
|
+
)
|
|
42
|
+
self.hash_map.update(
|
|
43
|
+
(c.id, (
|
|
44
|
+
c.access_hash,
|
|
45
|
+
EntityType.COMMUNITY if isinstance(c, types.Community) else (
|
|
46
|
+
EntityType.MEGAGROUP if getattr(c, 'megagroup', None) else (
|
|
47
|
+
EntityType.GIGAGROUP if getattr(c, 'gigagroup', None) else EntityType.CHANNEL
|
|
48
|
+
)
|
|
49
|
+
),
|
|
50
|
+
))
|
|
51
|
+
for c in chats
|
|
52
|
+
if getattr(c, 'access_hash', None) and not getattr(c, 'min', None)
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def put(self, entity):
|
|
56
|
+
self.hash_map[entity.id] = (entity.hash, entity.ty)
|
|
57
|
+
|
|
58
|
+
def retain(self, filter):
|
|
59
|
+
self.hash_map = {k: v for k, v in self.hash_map.items() if filter(k)}
|
|
60
|
+
|
|
61
|
+
def __len__(self):
|
|
62
|
+
return len(self.hash_map)
|