Commit Graph

2246 Commits

Author SHA1 Message Date
Lonami Exo
ad963fd23e Don't clear pending_ack on disconnect
Upon reconnecting, we must make sure to send all `pending_ack`,
or Telegram may resend some responses (e.g. causing duplicated
updates).
2019-03-28 12:16:15 +01:00
Lonami Exo
a59f53d592 Load entities for new via_bot property and forward 2019-03-28 11:07:41 +01:00
Lonami Exo
39d9531483 Implement _load_entities for all events
Follow-up of c902428af1
This means that now input_chat (and even chat_id) and
similar can be safely used, without needing get_input
2019-03-28 10:47:15 +01:00
Lonami Exo
5554b414e1 Propagate the last error on reconnect, not always ConnectionError 2019-03-28 10:11:33 +01:00
Lonami Exo
7523869875 Except IOError and not ConnectionError
PySocks' errors do not subclass ConnectionError so the library
was unnecessarily logging them as unexpected, when any IOError
was actually expected.
2019-03-28 09:54:35 +01:00
Lonami Exo
c902428af1 getDifference if the event's chat was not found (WIP) 2019-03-27 16:21:17 +01:00
Lonami Exo
8abc7ade22 Use the new in-memory entity cache
This should avoid a disk access every time an input entity
is needed, which is very often. Another step for #1141.
2019-03-26 11:39:25 +01:00
Lonami Exo
4d35e8c80f Create a new in-memory cache for entities (#1141) 2019-03-26 11:27:52 +01:00
Lonami Exo
facf3ae582 Fix-up user_id for UserUpdate 2019-03-26 09:18:18 +01:00
Lonami Exo
0239852cc7 Fix UserUpdate in chats 2019-03-26 09:14:55 +01:00
Lonami Exo
9db9db1ade Fix UserUpdate not working for typing updates
The code to deal with the right chat action was there,
but the updates that could trigger that code path were
never checked.
2019-03-26 08:57:16 +01:00
Lonami Exo
e71638abf1 Document that now incoming private messages can be revoked 2019-03-25 08:46:44 +01:00
Lonami
3126533a33
Update to layer 97 2019-03-24 18:14:18 +01:00
Lonami Exo
0b4d64947b Fix CallbackQuery.edit for messages via inline queries 2019-03-23 19:25:45 +01:00
Lonami Exo
f6fe580eb7 Safer auto reconnect to prevent double connect 2019-03-22 19:01:40 +01:00
Lonami Exo
9eabca6987 Fix run_until_disconnected's call to disconnect 2019-03-22 18:20:10 +01:00
Lonami Exo
436fb64289 Prevent double autoreconnect like #1112 2019-03-22 16:21:18 +01:00
Lonami Exo
0662ead33b Properly document all optional dependencies 2019-03-21 16:55:32 +01:00
Lonami Exo
347db79979 run_until_disconnected() should disconnect() on finally 2019-03-21 12:25:19 +01:00
Lonami Exo
04ba2e1fc7 Revert disconnect() to be async again (#1133)
It's the only way to properly clean all background tasks,
which the library makes heavy use for in MTProto/Connection
send and receive loops.

Some parts of the code even relied on the fact that it was
asynchronous (it used to return a future so you could await
it and not be breaking).

It's automatically syncified to reduce the damage of being
a breaking change.
2019-03-21 12:21:00 +01:00
Lonami Exo
8f302bcdb0 Don't disconnect() on __del__ (#1133)
Destructors are not guaranteed to run. Despite having good
intentions (saving entities even if the user forgets), it
should be the user's responsability to cleanly close the
client under any circumstances.
2019-03-21 11:40:57 +01:00
Lonami Exo
2e4476a754 Workaround #1134 by early checking if proxy closes connection 2019-03-21 11:22:09 +01:00
Lonami Exo
f6c4ab6f41 Workaround #1124 (Telegram ignoring offset_date) 2019-03-18 17:36:06 +01:00
Lonami Exo
7c48857d0c Update docs for send_file/timeouts and add new known error 2019-03-18 17:34:48 +01:00
Lonami Exo
a5f5d6ef23 Minor doc updates, fixes and improvements
In particular, removed code which no longer worked, made light
theme easier on the eyes, added slight syntax highlightning,
and fixed search for exact matches.
2019-03-16 17:19:19 +01:00
Lonami
05e5becd78
Merge pull request #1126 from seriyps/mtproto-proxy-other-protocols
Implement different MTProto proxy protocols
2019-03-13 18:26:19 +01:00
Lonami Exo
598b9f25e1 Fix DialogsIter not passing the client to the built objects 2019-03-13 09:12:44 +01:00
Lonami Exo
9d5344e90d Fix-up file to media calls from edit (from 3d72c10) 2019-03-12 22:18:57 +01:00
Сергей Прохоров
43505e0aad
Use issubclass instead of direct class comparison 2019-03-12 20:25:33 +01:00
Сергей Прохоров
fef580c24b
Revert non-related change 2019-03-12 01:28:59 +01:00
Сергей Прохоров
4696dfc25e
Rework class hierarchy, try to DRY more 2019-03-12 01:12:55 +01:00
Lonami Exo
916b379c03 Work around message edits arriving too early in conversations 2019-03-11 13:03:10 +01:00
Lonami Exo
1b703e905c Don't set self._state when checking if logged in
This essentially made catch_up useless after .start().
cc #1125 since this affects catch_up.
2019-03-11 09:04:08 +01:00
Lonami Exo
8884015dae Clarify some docstrings 2019-03-10 13:29:34 +01:00
Сергей Прохоров
b873aa67cc
Implement different mtproto proxy protocols; refactor obfuscated2 2019-03-10 03:26:24 +01:00
Lonami Exo
baa8970bb6 Fix handling message payloads that are too large 2019-03-06 18:08:51 +01:00
Lonami Exo
3d72c10ea5 Reduce calls to utils.is_image 2019-03-06 09:38:17 +01:00
Lonami Exo
758556cd30 Fix upload_file not seeking streams back
This would cause issues in _cache_media since utils.is_image fails
in the second pass (it respects the stream's position, and the user
may rightfully pass a stream that should be read only from one pos).
2019-03-06 09:24:50 +01:00
Lonami Exo
fcfebf75a3 Prevent pillow from closing non-exclusive fps (#1121) 2019-03-06 09:14:06 +01:00
Lonami Exo
ae8f1fed05 Treat arguments with _until or _since in their name as dates 2019-03-06 08:38:21 +01:00
Lonami Exo
0f69455dc7 Handle hachoir metadata more gracefully, bump 1.6.2
Since bf11bbd _get_extension supports plenty more things,
which hachoir cannot deal with. Add some extra safety checks.
2019-03-04 08:58:32 +01:00
Lonami Exo
6799295115 Fix iter_participants in non-channels 2019-03-02 21:17:36 +01:00
Lonami Exo
4cc2a17765 Deal with usability in methods that hit flood wait 2019-03-02 19:40:39 +01:00
Lonami Exo
dd1ca16ded Update docs, usability and errors for all methods 2019-03-02 19:01:20 +01:00
Wirtos
c4d65f8bf4 ValueError fix for IOBase files (#1119) 2019-03-01 21:27:15 +01:00
Lonami Exo
df534585e9 Actually fix ids= not being a list, bump 1.6.1 2019-02-28 08:31:28 +01:00
Lonami Exo
2681dc09bb Fix iter_messages with ids= not being a list 2019-02-28 08:26:37 +01:00
Manuel1510
70e0d865a8 Fix RequestIter.__next__ propagating StopAsyncIteration (#1117) 2019-02-28 08:07:31 +01:00
Lonami Exo
8429f9bd3c Update to v1.6 2019-02-27 21:04:18 +01:00
Lonami Exo
934c733ccb Treat users "kicking themselves" as leaving (#1116) 2019-02-27 19:42:17 +01:00