Commit Graph

1350 Commits

Author SHA1 Message Date
Lonami Exo
4b147f0153 Move clients to a new package 2018-06-09 21:11:35 +02:00
Lonami Exo
d76b27058f Warn on invoke and clean TelegramClient 2018-06-09 21:10:23 +02:00
Lonami Exo
3e151a1b7a Make TelegramBareClient able to invoke requests 2018-06-09 21:03:48 +02:00
Lonami Exo
7e68274f26 Keep consistent structure and remove done TODO 2018-06-09 15:42:10 +02:00
Lonami Exo
acd6025731 Use put_nowait and avoid double await 2018-06-09 15:26:13 +02:00
Lonami Exo
485ce5ca3b Ignore padding on server messages instead warning
There's 12..1024 padding for the MTProto 2.0 protocol, and
the length of the message can be used to determine how much
must be read on rpc_results. However this random padding
can be safely ignored.
2018-06-09 14:23:42 +02:00
Lonami Exo
be279ce3f5 Make TLMessage always have a valid TLObject
This simplifies the flow instead of having separate request/body
attributes, and also means that BinaryReader.tgread_object() can
be used without so many special cases.
2018-06-09 13:48:27 +02:00
Lonami Exo
f7e8907c6f Create RpcResult class and generalise core special cases
This results in a cleaner MTProtoSender, which now can always
read a TLObject with a guaranteed item, if the message is OK.
2018-06-09 13:13:55 +02:00
Lonami Exo
1e66cea9b7 Reuse some more code from MTProtoState 2018-06-09 11:36:59 +02:00
Lonami Exo
adfe861e9f Create a self-contained MTProtoState
This frees us from using entire Session objects in something
that's supposed to just send and receive items from the net.
2018-06-09 11:34:01 +02:00
Lonami Exo
cc5753137c Clean-up TelegramBareClient - unnecessary? 2018-06-08 21:52:59 +02:00
Lonami Exo
a63580c350 Private methods are not public API 2018-06-08 21:18:15 +02:00
Lonami Exo
6766c4eea9 Make heavy use of logging 2018-06-08 21:13:14 +02:00
Lonami Exo
e36517845a Retry on connection/security errors 2018-06-08 20:50:53 +02:00
Lonami Exo
92b606a3e8 Automatically reconnect on connection reset 2018-06-08 20:42:39 +02:00
Lonami Exo
5c917fb425 Except timeout error and retry 2018-06-07 18:01:18 +02:00
Lonami Exo
f72ddbdd5a Implement retry and fail cases in authenticator 2018-06-07 17:25:02 +02:00
Lonami Exo
df895a94ab Create auth_key if not present 2018-06-07 16:32:12 +02:00
Lonami Exo
a940e2e9a2 Process entities and add a handler for updates 2018-06-07 14:32:22 +02:00
Lonami Exo
c7e4ae8672 Send acks 2018-06-07 14:16:47 +02:00
Lonami Exo
805bf00dee Support sending multiple requests at once 2018-06-07 14:04:04 +02:00
Lonami Exo
884dbe2d1f Use a custom Queue to simplify the _send_loop 2018-06-07 13:51:19 +02:00
Lonami Exo
382355a22f Collapse multiple requests into a single container 2018-06-07 13:33:32 +02:00
Lonami Exo
a3687b8bb5 Complete all methods under MTProtoSender and document them 2018-06-07 12:29:43 +02:00
Lonami Exo
56b09c0c9d Properly set future results 2018-06-07 10:30:20 +02:00
Lonami Exo
9477c75fce Fix basic requests sending and receiving 2018-06-06 21:42:48 +02:00
Lonami Exo
e469258ab9 Create a new MTProtoSender structure and its foundation
This means that the TcpClient and the Connection (currently only
ConnectionTcpFull) will no longer be concerned about handling
errors, but the MTProtoSender will.

The foundation of the library will now be based on asyncio.
2018-06-06 20:41:01 +02:00
Lonami Exo
4bdc28a775 Show invalid bot methods in the docs 2018-06-06 17:35:06 +02:00
Lonami Exo
c7d7977951 Fetch invalid bot methods from pwrtelegram 2018-06-06 17:03:49 +02:00
Lonami Exo
ed5c44a260 Support deleting more than 100 messages at once 2018-06-05 21:27:49 +02:00
Lonami Exo
30ad06f29a Fix events.Raw not having ._set_client 2018-06-04 18:36:23 +02:00
Vaschuk Maxim
3db104c7bc to_bytes() named argument 'length' removed for PyPy (#834) 2018-06-04 12:34:52 +02:00
Lonami Exo
2e43fb3217 More nasty hacks to fix events.NewMessage attrs 2018-06-03 17:09:36 +02:00
Lonami Exo
fe3172b2c9 Fix accept TOS must be called after sign up (#824) 2018-06-03 16:47:19 +02:00
Lonami Exo
997f2b62ce Fix EventCommon/custom.Message conflicting properties 2018-06-03 16:41:13 +02:00
Lonami Exo
8c8a0153ef Revert 9db9d1e's count and fix typo 2018-06-03 15:20:52 +02:00
Lonami Exo
ab9d10c569 Update to v0.19.1 2018-06-03 14:20:50 +02:00
Lonami Exo
c2b8f8a1d6 Support editing media 2018-06-03 13:49:19 +02:00
Lonami Exo
2fb5215f5f Fix parsers misbehaving with None text 2018-06-03 13:48:43 +02:00
Lonami Exo
92b6e857a4 Separate file_to_media logic from send_file 2018-06-03 13:37:18 +02:00
Lonami Exo
e93b8f2b13 Update to layer 80 and accept TOS on sign_up (#824) 2018-06-03 13:26:51 +02:00
Lonami Exo
b2ed6caff4 Fix setattr for events.NewMessage/custom.Message 2018-06-03 13:00:07 +02:00
Lonami Exo
0a3151175d Fix infinite recursion on setattr custom.Message 2018-06-03 12:29:30 +02:00
Lonami Exo
81c61a0a2e Handle MessagesNotModified on iter_messages 2018-06-03 12:03:02 +02:00
Lonami Exo
8d7c7a19c0 Add some setters for custom.Message 2018-06-03 11:53:18 +02:00
Lonami Exo
8b16023566 Allow setting a per-client default parse mode 2018-06-03 11:29:48 +02:00
Lonami
12812ea542
Merge pull request #830 from LonamiWebs/new-message 2018-06-02 12:53:05 +02:00
Lonami Exo
f7222407de Document custom.Message 2018-06-02 12:52:38 +02:00
Lonami Exo
5c76af34aa Fix copy-paste typo 2018-06-02 12:38:47 +02:00
Lonami Exo
afbba219d5 Fix copy-paste typo 2018-06-02 12:38:03 +02:00