spluspy 1.0.0__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.
- spluspy/__init__.py +20 -0
- spluspy/_updates/__init__.py +3 -0
- spluspy/_updates/entitycache.py +59 -0
- spluspy/_updates/messagebox.py +826 -0
- spluspy/_updates/session.py +195 -0
- spluspy/client/__init__.py +25 -0
- spluspy/client/account.py +243 -0
- spluspy/client/auth.py +721 -0
- spluspy/client/bots.py +72 -0
- spluspy/client/buttons.py +101 -0
- spluspy/client/chats.py +1336 -0
- spluspy/client/dialogs.py +606 -0
- spluspy/client/downloads.py +1092 -0
- spluspy/client/messageparse.py +233 -0
- spluspy/client/messages.py +1524 -0
- spluspy/client/soroushclient.py +19 -0
- spluspy/client/telegrambaseclient.py +1015 -0
- spluspy/client/updates.py +719 -0
- spluspy/client/uploads.py +867 -0
- spluspy/client/users.py +623 -0
- spluspy/crypto/__init__.py +10 -0
- spluspy/crypto/aes.py +111 -0
- spluspy/crypto/aesctr.py +42 -0
- spluspy/crypto/authkey.py +63 -0
- spluspy/crypto/cdndecrypter.py +109 -0
- spluspy/crypto/factorization.py +67 -0
- spluspy/crypto/libssl.py +138 -0
- spluspy/crypto/rsa.py +268 -0
- spluspy/custom.py +1 -0
- spluspy/errors/__init__.py +46 -0
- spluspy/errors/common.py +180 -0
- spluspy/errors/rpcbaseerrors.py +135 -0
- spluspy/errors/rpcerrorlist.py +5356 -0
- spluspy/events/__init__.py +140 -0
- spluspy/events/album.py +343 -0
- spluspy/events/callbackquery.py +345 -0
- spluspy/events/chataction.py +458 -0
- spluspy/events/common.py +186 -0
- spluspy/events/inlinequery.py +247 -0
- spluspy/events/messagedeleted.py +57 -0
- spluspy/events/messageedited.py +52 -0
- spluspy/events/messageread.py +143 -0
- spluspy/events/newmessage.py +223 -0
- spluspy/events/raw.py +53 -0
- spluspy/events/userupdate.py +310 -0
- spluspy/extensions/__init__.py +6 -0
- spluspy/extensions/binaryreader.py +207 -0
- spluspy/extensions/html.py +203 -0
- spluspy/extensions/markdown.py +193 -0
- spluspy/extensions/messagepacker.py +122 -0
- spluspy/functions.py +1 -0
- spluspy/helpers.py +434 -0
- spluspy/hints.py +72 -0
- spluspy/network/__init__.py +14 -0
- spluspy/network/authenticator.py +212 -0
- spluspy/network/connection/__init__.py +13 -0
- spluspy/network/connection/connection.py +455 -0
- spluspy/network/connection/http.py +39 -0
- spluspy/network/connection/tcpabridged.py +33 -0
- spluspy/network/connection/tcpfull.py +58 -0
- spluspy/network/connection/tcpintermediate.py +46 -0
- spluspy/network/connection/tcpmtproxy.py +165 -0
- spluspy/network/connection/tcpobfuscated.py +62 -0
- spluspy/network/connection/websocket.py +275 -0
- spluspy/network/mtprotoplainsender.py +56 -0
- spluspy/network/mtprotosender.py +932 -0
- spluspy/network/mtprotostate.py +285 -0
- spluspy/network/requeststate.py +19 -0
- spluspy/password.py +194 -0
- spluspy/requestiter.py +134 -0
- spluspy/sessions/__init__.py +4 -0
- spluspy/sessions/abstract.py +172 -0
- spluspy/sessions/memory.py +263 -0
- spluspy/sessions/sqlite.py +388 -0
- spluspy/sessions/string.py +75 -0
- spluspy/sync.py +74 -0
- spluspy/tl/__init__.py +1 -0
- spluspy/tl/alltlobjects.py +1696 -0
- spluspy/tl/core/__init__.py +26 -0
- spluspy/tl/core/gzippacked.py +48 -0
- spluspy/tl/core/messagecontainer.py +47 -0
- spluspy/tl/core/rpcresult.py +35 -0
- spluspy/tl/core/tlmessage.py +34 -0
- spluspy/tl/custom/__init__.py +14 -0
- spluspy/tl/custom/adminlogevent.py +475 -0
- spluspy/tl/custom/button.py +346 -0
- spluspy/tl/custom/chatgetter.py +150 -0
- spluspy/tl/custom/conversation.py +529 -0
- spluspy/tl/custom/dialog.py +161 -0
- spluspy/tl/custom/draft.py +191 -0
- spluspy/tl/custom/file.py +146 -0
- spluspy/tl/custom/forward.py +51 -0
- spluspy/tl/custom/inlinebuilder.py +450 -0
- spluspy/tl/custom/inlineresult.py +176 -0
- spluspy/tl/custom/inlineresults.py +83 -0
- spluspy/tl/custom/inputsizedfile.py +9 -0
- spluspy/tl/custom/message.py +1243 -0
- spluspy/tl/custom/messagebutton.py +154 -0
- spluspy/tl/custom/participantpermissions.py +138 -0
- spluspy/tl/custom/qrlogin.py +119 -0
- spluspy/tl/custom/sendergetter.py +102 -0
- spluspy/tl/custom/types.py +38 -0
- spluspy/tl/functions/__init__.py +452 -0
- spluspy/tl/functions/account.py +1581 -0
- spluspy/tl/functions/auth.py +593 -0
- spluspy/tl/functions/bots.py +112 -0
- spluspy/tl/functions/channels.py +1672 -0
- spluspy/tl/functions/chatlists.py +325 -0
- spluspy/tl/functions/conference.py +437 -0
- spluspy/tl/functions/contacts.py +476 -0
- spluspy/tl/functions/folders.py +44 -0
- spluspy/tl/functions/help.py +259 -0
- spluspy/tl/functions/langpack.py +146 -0
- spluspy/tl/functions/messages.py +5469 -0
- spluspy/tl/functions/payments.py +292 -0
- spluspy/tl/functions/phone.py +809 -0
- spluspy/tl/functions/photos.py +282 -0
- spluspy/tl/functions/premium.py +152 -0
- spluspy/tl/functions/stats.py +300 -0
- spluspy/tl/functions/stories.py +765 -0
- spluspy/tl/functions/thirdParty.py +67 -0
- spluspy/tl/functions/updates.py +139 -0
- spluspy/tl/functions/upload.py +168 -0
- spluspy/tl/functions/users.py +170 -0
- spluspy/tl/patched/__init__.py +20 -0
- spluspy/tl/tlobject.py +222 -0
- spluspy/tl/types/__init__.py +40015 -0
- spluspy/tl/types/account.py +1096 -0
- spluspy/tl/types/auth.py +809 -0
- spluspy/tl/types/bots.py +43 -0
- spluspy/tl/types/channels.py +232 -0
- spluspy/tl/types/chatlists.py +273 -0
- spluspy/tl/types/conference.py +69 -0
- spluspy/tl/types/contacts.py +478 -0
- spluspy/tl/types/help.py +1206 -0
- spluspy/tl/types/messages.py +3000 -0
- spluspy/tl/types/payments.py +633 -0
- spluspy/tl/types/phone.py +313 -0
- spluspy/tl/types/photos.py +135 -0
- spluspy/tl/types/premium.py +209 -0
- spluspy/tl/types/stats.py +368 -0
- spluspy/tl/types/stickers.py +35 -0
- spluspy/tl/types/storage.py +197 -0
- spluspy/tl/types/stories.py +317 -0
- spluspy/tl/types/thirdParty.py +94 -0
- spluspy/tl/types/update.py +39 -0
- spluspy/tl/types/updates.py +447 -0
- spluspy/tl/types/upload.py +196 -0
- spluspy/tl/types/users.py +131 -0
- spluspy/types.py +1 -0
- spluspy/utils.py +1593 -0
- spluspy/version.py +3 -0
- spluspy-1.0.0.dist-info/METADATA +86 -0
- spluspy-1.0.0.dist-info/RECORD +156 -0
- spluspy-1.0.0.dist-info/WHEEL +5 -0
- spluspy-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
from .inlineresult import InlineResult
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class InlineResults(list):
|
|
7
|
+
"""
|
|
8
|
+
Custom class that encapsulates :tl:`BotResults` providing
|
|
9
|
+
an abstraction to easily access some commonly needed features
|
|
10
|
+
(such as clicking one of the results to select it)
|
|
11
|
+
|
|
12
|
+
Note that this is a list of `InlineResult
|
|
13
|
+
<spluspy.tl.custom.inlineresult.InlineResult>`
|
|
14
|
+
so you can iterate over it or use indices to
|
|
15
|
+
access its elements. In addition, it has some
|
|
16
|
+
attributes.
|
|
17
|
+
|
|
18
|
+
Attributes:
|
|
19
|
+
result (:tl:`BotResults`):
|
|
20
|
+
The original :tl:`BotResults` object.
|
|
21
|
+
|
|
22
|
+
query_id (`int`):
|
|
23
|
+
The random ID that identifies this query.
|
|
24
|
+
|
|
25
|
+
cache_time (`int`):
|
|
26
|
+
For how long the results should be considered
|
|
27
|
+
valid. You can call `results_valid` at any
|
|
28
|
+
moment to determine if the results are still
|
|
29
|
+
valid or not.
|
|
30
|
+
|
|
31
|
+
users (:tl:`User`):
|
|
32
|
+
The users present in this inline query.
|
|
33
|
+
|
|
34
|
+
gallery (`bool`):
|
|
35
|
+
Whether these results should be presented
|
|
36
|
+
in a grid (as a gallery of images) or not.
|
|
37
|
+
|
|
38
|
+
next_offset (`str`, optional):
|
|
39
|
+
The string to be used as an offset to get
|
|
40
|
+
the next chunk of results, if any.
|
|
41
|
+
|
|
42
|
+
switch_pm (:tl:`InlineBotSwitchPM`, optional):
|
|
43
|
+
If presents, the results should show a button to
|
|
44
|
+
switch to a private conversation with the bot using
|
|
45
|
+
the text in this object.
|
|
46
|
+
"""
|
|
47
|
+
def __init__(self, client, original, *, entity=None):
|
|
48
|
+
super().__init__(InlineResult(client, x, original.query_id, entity=entity)
|
|
49
|
+
for x in original.results)
|
|
50
|
+
|
|
51
|
+
self.result = original
|
|
52
|
+
self.query_id = original.query_id
|
|
53
|
+
self.cache_time = original.cache_time
|
|
54
|
+
self._valid_until = time.time() + self.cache_time
|
|
55
|
+
self.users = original.users
|
|
56
|
+
self.gallery = bool(original.gallery)
|
|
57
|
+
self.next_offset = original.next_offset
|
|
58
|
+
self.switch_pm = original.switch_pm
|
|
59
|
+
|
|
60
|
+
def results_valid(self):
|
|
61
|
+
"""
|
|
62
|
+
Returns `True` if the cache time has not expired
|
|
63
|
+
yet and the results can still be considered valid.
|
|
64
|
+
"""
|
|
65
|
+
return time.time() < self._valid_until
|
|
66
|
+
|
|
67
|
+
def _to_str(self, item_function):
|
|
68
|
+
return ('[{}, query_id={}, cache_time={}, users={}, gallery={}, '
|
|
69
|
+
'next_offset={}, switch_pm={}]'.format(
|
|
70
|
+
', '.join(item_function(x) for x in self),
|
|
71
|
+
self.query_id,
|
|
72
|
+
self.cache_time,
|
|
73
|
+
self.users,
|
|
74
|
+
self.gallery,
|
|
75
|
+
self.next_offset,
|
|
76
|
+
self.switch_pm
|
|
77
|
+
))
|
|
78
|
+
|
|
79
|
+
def __str__(self):
|
|
80
|
+
return self._to_str(str)
|
|
81
|
+
|
|
82
|
+
def __repr__(self):
|
|
83
|
+
return self._to_str(repr)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from ..types import InputFile
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class InputSizedFile(InputFile):
|
|
5
|
+
"""InputFile class with two extra parameters: md5 (digest) and size"""
|
|
6
|
+
def __init__(self, id_, parts, name, md5, size):
|
|
7
|
+
super().__init__(id_, parts, name, md5.hexdigest())
|
|
8
|
+
self.md5 = md5.digest()
|
|
9
|
+
self.size = size
|