soroushthon 0.2.21__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.
- soroushthon/__init__.py +13 -0
- soroushthon/_updates/__init__.py +3 -0
- soroushthon/_updates/entitycache.py +59 -0
- soroushthon/_updates/messagebox.py +830 -0
- soroushthon/_updates/session.py +195 -0
- soroushthon/client/__init__.py +26 -0
- soroushthon/client/account.py +278 -0
- soroushthon/client/auth.py +744 -0
- soroushthon/client/bots.py +72 -0
- soroushthon/client/buttons.py +101 -0
- soroushthon/client/chats.py +1346 -0
- soroushthon/client/dialogs.py +628 -0
- soroushthon/client/downloads.py +1120 -0
- soroushthon/client/interactions.py +252 -0
- soroushthon/client/messageparse.py +238 -0
- soroushthon/client/messages.py +1531 -0
- soroushthon/client/soroushclient.py +57 -0
- soroushthon/client/telegrambaseclient.py +1110 -0
- soroushthon/client/updates.py +793 -0
- soroushthon/client/uploads.py +877 -0
- soroushthon/client/users.py +703 -0
- soroushthon/crypto/__init__.py +10 -0
- soroushthon/crypto/aes.py +111 -0
- soroushthon/crypto/aesctr.py +42 -0
- soroushthon/crypto/authkey.py +63 -0
- soroushthon/crypto/cdndecrypter.py +109 -0
- soroushthon/crypto/factorization.py +67 -0
- soroushthon/crypto/libssl.py +138 -0
- soroushthon/crypto/rsa.py +268 -0
- soroushthon/custom.py +1 -0
- soroushthon/errors/__init__.py +46 -0
- soroushthon/errors/common.py +180 -0
- soroushthon/errors/rpcbaseerrors.py +135 -0
- soroushthon/errors/rpcerrorlist.py +5356 -0
- soroushthon/events/__init__.py +139 -0
- soroushthon/events/album.py +345 -0
- soroushthon/events/callbackquery.py +345 -0
- soroushthon/events/chataction.py +458 -0
- soroushthon/events/common.py +186 -0
- soroushthon/events/inlinequery.py +247 -0
- soroushthon/events/messagedeleted.py +57 -0
- soroushthon/events/messageedited.py +52 -0
- soroushthon/events/messageread.py +143 -0
- soroushthon/events/newmessage.py +223 -0
- soroushthon/events/raw.py +53 -0
- soroushthon/events/userupdate.py +310 -0
- soroushthon/extensions/__init__.py +6 -0
- soroushthon/extensions/binaryreader.py +210 -0
- soroushthon/extensions/html.py +208 -0
- soroushthon/extensions/markdown.py +193 -0
- soroushthon/extensions/messagepacker.py +122 -0
- soroushthon/functions.py +1 -0
- soroushthon/helpers.py +434 -0
- soroushthon/hints.py +72 -0
- soroushthon/network/__init__.py +14 -0
- soroushthon/network/authenticator.py +212 -0
- soroushthon/network/connection/__init__.py +13 -0
- soroushthon/network/connection/connection.py +455 -0
- soroushthon/network/connection/http.py +39 -0
- soroushthon/network/connection/tcpabridged.py +33 -0
- soroushthon/network/connection/tcpfull.py +58 -0
- soroushthon/network/connection/tcpintermediate.py +46 -0
- soroushthon/network/connection/tcpmtproxy.py +165 -0
- soroushthon/network/connection/tcpobfuscated.py +62 -0
- soroushthon/network/connection/websocket.py +433 -0
- soroushthon/network/mtprotoplainsender.py +56 -0
- soroushthon/network/mtprotosender.py +983 -0
- soroushthon/network/mtprotostate.py +285 -0
- soroushthon/network/requeststate.py +19 -0
- soroushthon/password.py +194 -0
- soroushthon/requestiter.py +134 -0
- soroushthon/sessions/__init__.py +4 -0
- soroushthon/sessions/abstract.py +172 -0
- soroushthon/sessions/memory.py +260 -0
- soroushthon/sessions/sqlite.py +393 -0
- soroushthon/sessions/string.py +72 -0
- soroushthon/sync.py +74 -0
- soroushthon/tl/__init__.py +1 -0
- soroushthon/tl/alltlobjects.py +1696 -0
- soroushthon/tl/core/__init__.py +26 -0
- soroushthon/tl/core/gzippacked.py +48 -0
- soroushthon/tl/core/messagecontainer.py +47 -0
- soroushthon/tl/core/rpcresult.py +35 -0
- soroushthon/tl/core/tlmessage.py +34 -0
- soroushthon/tl/custom/__init__.py +14 -0
- soroushthon/tl/custom/adminlogevent.py +475 -0
- soroushthon/tl/custom/button.py +346 -0
- soroushthon/tl/custom/chatgetter.py +154 -0
- soroushthon/tl/custom/conversation.py +529 -0
- soroushthon/tl/custom/dialog.py +161 -0
- soroushthon/tl/custom/draft.py +194 -0
- soroushthon/tl/custom/file.py +146 -0
- soroushthon/tl/custom/forward.py +51 -0
- soroushthon/tl/custom/inlinebuilder.py +450 -0
- soroushthon/tl/custom/inlineresult.py +176 -0
- soroushthon/tl/custom/inlineresults.py +83 -0
- soroushthon/tl/custom/inputsizedfile.py +9 -0
- soroushthon/tl/custom/message.py +1250 -0
- soroushthon/tl/custom/messagebutton.py +160 -0
- soroushthon/tl/custom/participantpermissions.py +138 -0
- soroushthon/tl/custom/qrlogin.py +119 -0
- soroushthon/tl/custom/sendergetter.py +106 -0
- soroushthon/tl/custom/types.py +38 -0
- soroushthon/tl/functions/__init__.py +452 -0
- soroushthon/tl/functions/account.py +1581 -0
- soroushthon/tl/functions/auth.py +593 -0
- soroushthon/tl/functions/bots.py +112 -0
- soroushthon/tl/functions/channels.py +1672 -0
- soroushthon/tl/functions/chatlists.py +325 -0
- soroushthon/tl/functions/conference.py +437 -0
- soroushthon/tl/functions/contacts.py +476 -0
- soroushthon/tl/functions/folders.py +44 -0
- soroushthon/tl/functions/help.py +259 -0
- soroushthon/tl/functions/langpack.py +146 -0
- soroushthon/tl/functions/messages.py +5469 -0
- soroushthon/tl/functions/payments.py +292 -0
- soroushthon/tl/functions/phone.py +809 -0
- soroushthon/tl/functions/photos.py +282 -0
- soroushthon/tl/functions/premium.py +152 -0
- soroushthon/tl/functions/stats.py +300 -0
- soroushthon/tl/functions/stories.py +765 -0
- soroushthon/tl/functions/thirdParty.py +67 -0
- soroushthon/tl/functions/updates.py +139 -0
- soroushthon/tl/functions/upload.py +168 -0
- soroushthon/tl/functions/users.py +170 -0
- soroushthon/tl/patched/__init__.py +20 -0
- soroushthon/tl/tlobject.py +222 -0
- soroushthon/tl/types/__init__.py +40015 -0
- soroushthon/tl/types/account.py +1096 -0
- soroushthon/tl/types/auth.py +809 -0
- soroushthon/tl/types/bots.py +43 -0
- soroushthon/tl/types/channels.py +232 -0
- soroushthon/tl/types/chatlists.py +273 -0
- soroushthon/tl/types/conference.py +69 -0
- soroushthon/tl/types/contacts.py +478 -0
- soroushthon/tl/types/help.py +1206 -0
- soroushthon/tl/types/messages.py +3000 -0
- soroushthon/tl/types/payments.py +633 -0
- soroushthon/tl/types/phone.py +313 -0
- soroushthon/tl/types/photos.py +135 -0
- soroushthon/tl/types/premium.py +209 -0
- soroushthon/tl/types/stats.py +368 -0
- soroushthon/tl/types/stickers.py +35 -0
- soroushthon/tl/types/storage.py +197 -0
- soroushthon/tl/types/stories.py +317 -0
- soroushthon/tl/types/thirdParty.py +94 -0
- soroushthon/tl/types/update.py +39 -0
- soroushthon/tl/types/updates.py +447 -0
- soroushthon/tl/types/upload.py +196 -0
- soroushthon/tl/types/users.py +131 -0
- soroushthon/types.py +1 -0
- soroushthon/utils.py +1577 -0
- soroushthon/version.py +1 -0
- soroushthon-0.2.21.dist-info/METADATA +65 -0
- soroushthon-0.2.21.dist-info/RECORD +188 -0
- soroushthon-0.2.21.dist-info/WHEEL +5 -0
- soroushthon-0.2.21.dist-info/licenses/LICENSE +674 -0
- soroushthon-0.2.21.dist-info/licenses/NOTICE.md +7 -0
- soroushthon-0.2.21.dist-info/licenses/TELETHON_LICENSE +21 -0
- soroushthon-0.2.21.dist-info/top_level.txt +2 -0
- soroushthon_generator/__init__.py +1 -0
- soroushthon_generator/data/api.tl +1638 -0
- soroushthon_generator/data/errors.csv +534 -0
- soroushthon_generator/data/friendly.csv +26 -0
- soroushthon_generator/data/html/404.html +44 -0
- soroushthon_generator/data/html/core.html +179 -0
- soroushthon_generator/data/html/css/docs.dark.css +185 -0
- soroushthon_generator/data/html/css/docs.h4x0r.css +229 -0
- soroushthon_generator/data/html/css/docs.light.css +182 -0
- soroushthon_generator/data/html/img/arrow.svg +35 -0
- soroushthon_generator/data/html/js/search.js +244 -0
- soroushthon_generator/data/methods.csv +365 -0
- soroushthon_generator/data/mtproto.tl +116 -0
- soroushthon_generator/docswriter.py +295 -0
- soroushthon_generator/generators/__init__.py +3 -0
- soroushthon_generator/generators/docs.py +649 -0
- soroushthon_generator/generators/errors.py +60 -0
- soroushthon_generator/generators/tlobject.py +720 -0
- soroushthon_generator/parsers/__init__.py +3 -0
- soroushthon_generator/parsers/errors.py +85 -0
- soroushthon_generator/parsers/methods.py +67 -0
- soroushthon_generator/parsers/tlobject/__init__.py +3 -0
- soroushthon_generator/parsers/tlobject/parser.py +148 -0
- soroushthon_generator/parsers/tlobject/tlarg.py +256 -0
- soroushthon_generator/parsers/tlobject/tlobject.py +177 -0
- soroushthon_generator/sourcebuilder.py +65 -0
- soroushthon_generator/syncerrors.py +55 -0
- soroushthon_generator/utils.py +8 -0
soroushthon/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .client.soroushclient import SoroushClient
|
|
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
|
+
'SoroushClient', 'Button',
|
|
11
|
+
'types', 'functions', 'custom', 'errors',
|
|
12
|
+
'events', 'utils', 'connection'
|
|
13
|
+
]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from .session import EntityType, Entity
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
_sentinel = object()
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EntityCache:
|
|
8
|
+
def __init__(
|
|
9
|
+
self,
|
|
10
|
+
hash_map: dict = _sentinel,
|
|
11
|
+
self_id: int = None,
|
|
12
|
+
self_bot: bool = None
|
|
13
|
+
):
|
|
14
|
+
self.hash_map = {} if hash_map is _sentinel else hash_map
|
|
15
|
+
self.self_id = self_id
|
|
16
|
+
self.self_bot = self_bot
|
|
17
|
+
|
|
18
|
+
def set_self_user(self, id, bot, hash):
|
|
19
|
+
self.self_id = id
|
|
20
|
+
self.self_bot = bot
|
|
21
|
+
if hash:
|
|
22
|
+
self.hash_map[id] = (hash, EntityType.BOT if bot else EntityType.USER)
|
|
23
|
+
|
|
24
|
+
def get(self, id):
|
|
25
|
+
try:
|
|
26
|
+
hash, ty = self.hash_map[id]
|
|
27
|
+
return Entity(ty, id, hash)
|
|
28
|
+
except KeyError:
|
|
29
|
+
return None
|
|
30
|
+
|
|
31
|
+
def extend(self, users, chats):
|
|
32
|
+
# See https://core.telegram.org/api/min for "issues" with "min constructors".
|
|
33
|
+
self.hash_map.update(
|
|
34
|
+
(u.id, (
|
|
35
|
+
u.access_hash,
|
|
36
|
+
EntityType.BOT if u.bot else EntityType.USER,
|
|
37
|
+
))
|
|
38
|
+
for u in users
|
|
39
|
+
if getattr(u, 'access_hash', None) and not u.min
|
|
40
|
+
)
|
|
41
|
+
self.hash_map.update(
|
|
42
|
+
(c.id, (
|
|
43
|
+
c.access_hash,
|
|
44
|
+
EntityType.MEGAGROUP if c.megagroup else (
|
|
45
|
+
EntityType.GIGAGROUP if getattr(c, 'gigagroup', None) else EntityType.CHANNEL
|
|
46
|
+
),
|
|
47
|
+
))
|
|
48
|
+
for c in chats
|
|
49
|
+
if getattr(c, 'access_hash', None) and not getattr(c, 'min', None)
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def put(self, entity):
|
|
53
|
+
self.hash_map[entity.id] = (entity.hash, entity.ty)
|
|
54
|
+
|
|
55
|
+
def retain(self, filter):
|
|
56
|
+
self.hash_map = {k: v for k, v in self.hash_map.items() if filter(k)}
|
|
57
|
+
|
|
58
|
+
def __len__(self):
|
|
59
|
+
return len(self.hash_map)
|