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.
Files changed (172) hide show
  1. catethon/__init__.py +13 -0
  2. catethon/_updates/__init__.py +3 -0
  3. catethon/_updates/entitycache.py +62 -0
  4. catethon/_updates/messagebox.py +825 -0
  5. catethon/_updates/session.py +198 -0
  6. catethon/cat/__init__.py +36 -0
  7. catethon/cat/config.py +113 -0
  8. catethon/cat/keys/thecat-prod-rsa.pub +9 -0
  9. catethon/cat/proxy.py +51 -0
  10. catethon/cat/rsapad.py +111 -0
  11. catethon/cat/server.py +185 -0
  12. catethon/cat/session.py +85 -0
  13. catethon/client/__init__.py +25 -0
  14. catethon/client/account.py +243 -0
  15. catethon/client/auth.py +677 -0
  16. catethon/client/bots.py +72 -0
  17. catethon/client/buttons.py +104 -0
  18. catethon/client/chats.py +1336 -0
  19. catethon/client/dialogs.py +610 -0
  20. catethon/client/downloads.py +1092 -0
  21. catethon/client/messageparse.py +233 -0
  22. catethon/client/messages.py +1637 -0
  23. catethon/client/telegrambaseclient.py +979 -0
  24. catethon/client/telegramclient.py +13 -0
  25. catethon/client/updates.py +733 -0
  26. catethon/client/uploads.py +870 -0
  27. catethon/client/users.py +620 -0
  28. catethon/crypto/__init__.py +10 -0
  29. catethon/crypto/aes.py +111 -0
  30. catethon/crypto/aesctr.py +42 -0
  31. catethon/crypto/authkey.py +63 -0
  32. catethon/crypto/cdndecrypter.py +105 -0
  33. catethon/crypto/factorization.py +67 -0
  34. catethon/crypto/libssl.py +140 -0
  35. catethon/crypto/rsa.py +165 -0
  36. catethon/custom.py +1 -0
  37. catethon/errors/__init__.py +46 -0
  38. catethon/errors/common.py +180 -0
  39. catethon/errors/rpcbaseerrors.py +131 -0
  40. catethon/errors/rpcerrorlist.py +5356 -0
  41. catethon/events/__init__.py +140 -0
  42. catethon/events/album.py +343 -0
  43. catethon/events/callbackquery.py +346 -0
  44. catethon/events/chataction.py +458 -0
  45. catethon/events/common.py +186 -0
  46. catethon/events/inlinequery.py +247 -0
  47. catethon/events/messagedeleted.py +57 -0
  48. catethon/events/messageedited.py +52 -0
  49. catethon/events/messageread.py +143 -0
  50. catethon/events/newmessage.py +223 -0
  51. catethon/events/raw.py +53 -0
  52. catethon/events/userupdate.py +310 -0
  53. catethon/extensions/__init__.py +6 -0
  54. catethon/extensions/binaryreader.py +201 -0
  55. catethon/extensions/html.py +208 -0
  56. catethon/extensions/markdown.py +193 -0
  57. catethon/extensions/messagepacker.py +111 -0
  58. catethon/functions.py +1 -0
  59. catethon/helpers.py +436 -0
  60. catethon/hints.py +72 -0
  61. catethon/network/__init__.py +14 -0
  62. catethon/network/authenticator.py +212 -0
  63. catethon/network/connection/__init__.py +12 -0
  64. catethon/network/connection/connection.py +440 -0
  65. catethon/network/connection/http.py +39 -0
  66. catethon/network/connection/tcpabridged.py +33 -0
  67. catethon/network/connection/tcpfull.py +62 -0
  68. catethon/network/connection/tcpintermediate.py +46 -0
  69. catethon/network/connection/tcpmtproxy.py +165 -0
  70. catethon/network/connection/tcpobfuscated.py +62 -0
  71. catethon/network/mtprotoplainsender.py +56 -0
  72. catethon/network/mtprotosender.py +942 -0
  73. catethon/network/mtprotostate.py +285 -0
  74. catethon/network/requeststate.py +19 -0
  75. catethon/password.py +194 -0
  76. catethon/requestiter.py +134 -0
  77. catethon/sessions/__init__.py +4 -0
  78. catethon/sessions/abstract.py +172 -0
  79. catethon/sessions/memory.py +260 -0
  80. catethon/sessions/sqlite.py +385 -0
  81. catethon/sessions/string.py +63 -0
  82. catethon/sync.py +74 -0
  83. catethon/tl/__init__.py +1 -0
  84. catethon/tl/alltlobjects.py +2666 -0
  85. catethon/tl/core/__init__.py +26 -0
  86. catethon/tl/core/gzippacked.py +48 -0
  87. catethon/tl/core/messagecontainer.py +47 -0
  88. catethon/tl/core/rpcresult.py +35 -0
  89. catethon/tl/core/tlmessage.py +34 -0
  90. catethon/tl/custom/__init__.py +14 -0
  91. catethon/tl/custom/adminlogevent.py +475 -0
  92. catethon/tl/custom/button.py +347 -0
  93. catethon/tl/custom/chatgetter.py +150 -0
  94. catethon/tl/custom/conversation.py +529 -0
  95. catethon/tl/custom/dialog.py +172 -0
  96. catethon/tl/custom/draft.py +191 -0
  97. catethon/tl/custom/file.py +146 -0
  98. catethon/tl/custom/forward.py +51 -0
  99. catethon/tl/custom/inlinebuilder.py +450 -0
  100. catethon/tl/custom/inlineresult.py +176 -0
  101. catethon/tl/custom/inlineresults.py +83 -0
  102. catethon/tl/custom/inputsizedfile.py +9 -0
  103. catethon/tl/custom/message.py +1248 -0
  104. catethon/tl/custom/messagebutton.py +154 -0
  105. catethon/tl/custom/participantpermissions.py +138 -0
  106. catethon/tl/custom/qrlogin.py +119 -0
  107. catethon/tl/custom/sendergetter.py +102 -0
  108. catethon/tl/functions/__init__.py +717 -0
  109. catethon/tl/functions/account.py +4034 -0
  110. catethon/tl/functions/aicompose.py +260 -0
  111. catethon/tl/functions/auth.py +1057 -0
  112. catethon/tl/functions/bots.py +1497 -0
  113. catethon/tl/functions/channels.py +2254 -0
  114. catethon/tl/functions/chatlists.py +425 -0
  115. catethon/tl/functions/communities.py +359 -0
  116. catethon/tl/functions/contacts.py +1034 -0
  117. catethon/tl/functions/ephemeral.py +456 -0
  118. catethon/tl/functions/folders.py +44 -0
  119. catethon/tl/functions/fragment.py +39 -0
  120. catethon/tl/functions/help.py +672 -0
  121. catethon/tl/functions/langpack.py +178 -0
  122. catethon/tl/functions/messages.py +11597 -0
  123. catethon/tl/functions/payments.py +2917 -0
  124. catethon/tl/functions/phone.py +1794 -0
  125. catethon/tl/functions/photos.py +282 -0
  126. catethon/tl/functions/premium.py +188 -0
  127. catethon/tl/functions/smsjobs.py +180 -0
  128. catethon/tl/functions/stats.py +332 -0
  129. catethon/tl/functions/stickers.py +440 -0
  130. catethon/tl/functions/stories.py +1574 -0
  131. catethon/tl/functions/toncenter.py +75 -0
  132. catethon/tl/functions/updates.py +139 -0
  133. catethon/tl/functions/upload.py +300 -0
  134. catethon/tl/functions/users.py +285 -0
  135. catethon/tl/functions/wallet.py +928 -0
  136. catethon/tl/patched/__init__.py +20 -0
  137. catethon/tl/tlobject.py +222 -0
  138. catethon/tl/types/__init__.py +56275 -0
  139. catethon/tl/types/account.py +1501 -0
  140. catethon/tl/types/aicompose.py +75 -0
  141. catethon/tl/types/auth.py +972 -0
  142. catethon/tl/types/bots.py +229 -0
  143. catethon/tl/types/channels.py +307 -0
  144. catethon/tl/types/chatlists.py +276 -0
  145. catethon/tl/types/communities.py +135 -0
  146. catethon/tl/types/contacts.py +548 -0
  147. catethon/tl/types/ephemeral.py +66 -0
  148. catethon/tl/types/fragment.py +55 -0
  149. catethon/tl/types/help.py +1248 -0
  150. catethon/tl/types/messages.py +4044 -0
  151. catethon/tl/types/payments.py +1965 -0
  152. catethon/tl/types/phone.py +368 -0
  153. catethon/tl/types/photos.py +135 -0
  154. catethon/tl/types/premium.py +209 -0
  155. catethon/tl/types/smsjobs.py +100 -0
  156. catethon/tl/types/stats.py +396 -0
  157. catethon/tl/types/stickers.py +35 -0
  158. catethon/tl/types/storage.py +197 -0
  159. catethon/tl/types/stories.py +563 -0
  160. catethon/tl/types/toncenter.py +70 -0
  161. catethon/tl/types/updates.py +447 -0
  162. catethon/tl/types/upload.py +196 -0
  163. catethon/tl/types/users.py +191 -0
  164. catethon/tl/types/wallet.py +663 -0
  165. catethon/types.py +1 -0
  166. catethon/utils.py +1584 -0
  167. catethon/version.py +15 -0
  168. catethon-1.46.1.dist-info/METADATA +192 -0
  169. catethon-1.46.1.dist-info/RECORD +172 -0
  170. catethon-1.46.1.dist-info/WHEEL +4 -0
  171. catethon-1.46.1.dist-info/licenses/LICENSE +21 -0
  172. 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,3 @@
1
+ from .entitycache import EntityCache
2
+ from .messagebox import MessageBox, GapError, PrematureEndReason
3
+ from .session import SessionState, ChannelState, Entity, EntityType
@@ -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)