Lonami Exo
c0828f590f
Fix resize if needed not seeking back for image = bytes
2019-04-02 08:59:35 +02:00
Lonami Exo
85be48f42b
Document misleading message.out value for events.MessageEdited
2019-04-02 08:39:19 +02:00
Lonami Exo
38900c5079
Fix CallbackQuery.edit for normal queries ( 0b4d649
)
2019-04-02 08:37:24 +02:00
Lonami Exo
3398bee77a
Handle disconnection errors more gracefully in background tasks
2019-04-01 08:46:07 +02:00
Lonami Exo
34a8140ff0
Fix MessageRead had blacklist_chat=None and not False
...
This was causing the checks against chats to fail. In addition
to that, before setting the attribute, it is now casted to bool
to prevent more issues like this in the future (or if users
use non-boolean values).
2019-03-31 12:15:48 +02:00
Lonami Exo
c95467ea3e
Fix ._chat_peer could be None in Event.filter()
2019-03-31 12:15:48 +02:00
bugchecker
7225b7a40f
Fix RequestIter.__anext__ without __ainit__ ( #1142 )
2019-03-29 18:32:00 +01:00
Lonami Exo
5377169db2
Call catch_up on reconnect (WIP for #1125 )
2019-03-28 12:32:02 +01:00
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 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
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
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
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
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
Lonami Exo
05d174d4ce
Update documentation, errors and add TODOs
2019-02-27 19:30:12 +01:00
Lonami Exo
f66d65d409
Add RequestIter._next__ for synchronous iteration
2019-02-27 16:13:11 +01:00
Lonami Exo
6b50152bb3
Use constants for chunk sizes, remove irrelevant TODO
2019-02-27 13:07:25 +01:00
Lonami Exo
d02d0e2d5e
Handle negative limits gracefully in async generators
...
We rely on >= 0 for setting the batch size to use (which must
be valid), so it makes sense to make negative limits equal 0.
This is similar to how asyncio.sleep(negative) sleeps 0 seconds,
despite the fact that time.sleep(negative) fails.
2019-02-27 13:01:04 +01:00
Lonami Exo
d508e58d49
Remove the "private" _total parameter
2019-02-27 12:59:50 +01:00
Lonami Exo
bf71e49fcc
Remove batch_size parameter from iter_messages
...
It was only useful for testing purposes, and no other methods
exposed this kind of parameter (but they still use it).
2019-02-27 12:57:54 +01:00
Lonami Exo
b9133567af
Remove weird map chr range from aggressive iter_participants
2019-02-27 12:51:09 +01:00
Lonami Exo
c73b8eda26
Simplify filling RequestIter's buffer
2019-02-27 11:25:35 +01:00
Lonami Exo
40ded93c7c
Use RequestIter in chat methods
2019-02-27 11:12:05 +01:00
Lonami Exo
4f647847e7
Fix RequestIter not setting TotalList.total in collect()
2019-02-27 10:39:56 +01:00
Lonami Exo
968da5f72d
Use RequestIter in the dialog methods
2019-02-27 10:38:50 +01:00
Lonami Exo
49d8a3fb33
Remove code to syncify async generator functions
2019-02-27 10:19:08 +01:00
Lonami Exo
5b8e6531fa
Add method to collect RequestIter into TotalList
2019-02-27 10:15:32 +01:00
Lonami Exo
6d6c1917bc
Implement iterator over message by IDs
2019-02-27 10:04:12 +01:00
Lonami Exo
60606b9994
Don't make iter_messages a coroutine function
2019-02-27 09:49:14 +01:00
Lonami Exo
35dc46ffb0
Fix searching messages in reverse
2019-02-27 09:48:47 +01:00
Lonami Exo
e3991fadd5
Fix updating offset
2019-02-27 09:37:12 +01:00
Lonami Exo
f765f73fa3
Fix setting batch size
2019-02-27 09:32:33 +01:00
Lonami Exo
e2f44ddbea
Make iter_messages use a common message iterator
2019-02-27 09:31:15 +01:00
Lonami Exo
19f38d6733
Implement iter_messages with search
2019-02-26 21:04:46 +01:00
Lonami Exo
36eb1b1009
Create a new RequestIter ABC to deal with iter methods
...
This should make it easier to maintain these methods, increase
reusability, and get rid of the async_generator dependency.
In the future, people could use this to more easily deal with
raw API themselves.
2019-02-26 20:26:40 +01:00
Lonami Exo
1e4a12d2f7
Clean up iter_messages with reverse=True
2019-02-26 09:42:28 +01:00
Lonami Exo
5b098a909a
Cleanup converting to input media in send album
2019-02-25 18:25:49 +01:00
Lonami Exo
8e36c0002b
Fix sending albums with bot file IDs
2019-02-25 18:23:39 +01:00
Lonami Exo
70b08c4952
Get rid of broken JSON migration support ( #1113 )
2019-02-24 20:16:53 +01:00
Lonami Exo
0934f71c02
Update to layer 95
2019-02-21 12:40:47 +01:00
Lonami Exo
abadf3c789
Provide a blanket implementation for _init_conn
2019-02-21 10:43:31 +01:00
Lonami Exo
6de7329ce7
Fix Connection abstraction leak
2019-02-21 10:41:33 +01:00
Lonami Exo
96270bdc18
Fix sending PNGs without alpha channel, edit size typo
2019-02-19 17:48:27 +01:00
Lonami Exo
6db60627e6
Clearer error on send_file(chat, invalid type)
2019-02-19 16:41:51 +01:00
Lonami Exo
f540c4e089
Fix order of inline results not being preserved
2019-02-14 20:03:02 +01:00
Lonami Exo
628a16f287
Document new errors and limits for inline results
2019-02-14 19:45:25 +01:00
Lonami Exo
41bfb8ae52
Fix photo resizing not working for images with alpha channels
2019-02-14 12:12:17 +01:00
Lonami Exo
d1c755809d
Except RpcMcgetFailError as call fail and sleep on server errors
...
This one in particular may happen when iterating over messages,
perhaps more likely to happen if the group was created in a
different data center.
A small sleep of a few seconds also greatly increases the
chances of the error going away.
2019-02-14 11:00:37 +01:00
nosanity
2e544270cd
Fix login failure due to wrong argument name ( #1109 )
2019-02-14 16:46:57 +10:00
Lonami Exo
559a40c7ea
Fix get_input_media for InputFile
...
It was actually using FileLocation, which had the invalid expected
type for what was being returned. Instead it should have been this
other type.
In addition, more parameters are passed so that the method can have
all the information it needs to correctly cast the type.
2019-02-13 12:33:11 +01:00
Lonami Exo
99ad26bfa4
Lower the maximum amount of requests per container
2019-02-13 10:16:59 +01:00
Lonami Exo
5c85f830bd
Further document automatic photo resizing
2019-02-13 09:58:02 +01:00
Lonami Exo
fd24f7087e
Resize photos when sending files if needed
2019-02-13 09:50:00 +01:00
Lonami Exo
5772a5483c
Check dc_id in resolve_bot_file_id
2019-02-13 09:16:34 +01:00
Lonami Exo
47d9de98ed
Raise ImportError and not ValueError when sqlite3 is missing
...
Excepting ValueError when creating the SQLiteSession could hide
other errors (e.g. using a newer session file on an older version
of the library). Instead, the original error is raised, as if
sqlite3 was being imported within its __init__ method.
2019-02-13 08:52:54 +01:00
Dmitry D. Chernov
d25442345e
Fix incorrect sending of DC id when connecting to MTProxy
2019-02-12 21:17:08 +10:00
Lonami Exo
4899788d92
Expose phone and phone_code_hash in sign_up
2019-02-12 11:44:36 +01:00
Lonami Exo
bf11bbd8a6
Support sending bytes/stream as photos (improved _get_extension)
...
Letting _get_extension work for photos even when the only information
available is a stream or a few bytes allows sending arbitrary bytes
as photos, if force_document was not set to True explicitly.
2019-02-12 11:33:06 +01:00
Lonami Exo
1007e19172
Fix get_peer_id not working with InputPeerSelf
2019-02-11 10:40:35 +01:00
Dmitry D. Chernov
3b4d00564d
Detail docstring about the 'proxy' parameter in TelegramClient
2019-02-11 18:54:35 +10:00
Dmitry D. Chernov
45d0ba9e2f
Initial implementation of MTProxy support ( #1107 )
2019-02-11 00:16:46 +01:00
Dmitry D. Chernov
8c428e8566
Fix broken connection establishment in ConnectionTcpObfuscated
...
This regression was introduced in ebde3be820
.
2019-02-11 07:54:59 +10:00
Dmitry D. Chernov
c39cc06908
Fix incorrect check for reserved data prefix in ConnectionTcpObfuscated
2019-02-11 05:47:09 +10:00
Lonami Exo
de84bf08bf
Support MessageMedia in pack_bot_file_id
2019-02-10 12:30:20 +01:00
Lonami Exo
e23308c0f9
Fix accessing conversation messages that arrived too early
2019-02-10 11:46:39 +01:00
Dmitry D. Chernov
9a98d41a2c
Improve TakeoutClient proxy and takeout functionality ( #1106 )
2019-02-10 11:10:41 +01:00
Dmitry D. Chernov
274fa72a8c
Correctly proxy __class__ in TakeoutClient for #1103 ( #1105 )
2019-02-07 16:51:16 +01:00
Lonami Exo
abd26af0ad
Update misleading error message
2019-02-07 10:16:03 +01:00
Dmitry D. Chernov
fc2977fc0d
Tiny style fixes
2019-02-07 06:55:34 +10:00
Dmitry D. Chernov
c8f16a4e89
Fix a couple of inconsistencies in the public interface ( #1102 )
...
* Create `_NOT_A_REQUEST` when needed. Currently, modifications
in the raised exception would be "global".
* `retries` parameters were actually attempts. This has been fixed
to actually be the amount of retries, so 0 now means don't retry.
* Helper function to deal with retries instead of using a range with
different styles every time.
2019-02-06 19:41:45 +01:00
Thorbijoern
c9e9b82eac
Update resolve_bot_file_id to latest layer ( #1100 )
...
It is now possible to replace the dummy image with None.
2019-02-03 00:14:39 +01:00
Lonami Exo
b79c4510a6
Update to v1.5.5
2019-02-02 11:36:38 +01:00
Lonami Exo
c2c8a3caeb
Saner timeouts for conversation ( #1099 )
2019-01-31 11:11:20 +01:00
Lonami Exo
8492300780
Fix search in private chats when from_user was not given
2019-01-31 11:11:20 +01:00
Lonami Exo
10cd61d2f9
Add missing timezone info in important places
...
Things like SQLAlchemy work correctly only for timezone-aware datetimes.
The returned TLObjects all have them, but those that are manually created
were missing them, so serializing the state into SQLAlchemy sessions failed.
2019-01-24 11:16:40 +01:00
Lonami Exo
d1fee27814
Register several known mimetypes ( #1096 )
2019-01-23 14:37:40 +01:00
Kirill
747caf1652
Support Path-like values for thumb in _file_to_media ( #1095 )
2019-01-22 18:52:53 +01:00
Lonami Exo
bb5c1f24c6
Update to layer 93
2019-01-21 20:09:13 +01:00
Lonami Exo
8f44364c6c
Add supports_streaming to send_file and update docs/errors
2019-01-21 19:47:17 +01:00
Lonami Exo
b0883148f5
Document more RPC errors
...
These two occur when replying to an inline query with a photo and
InputBotInlineMessageMediaAuto empty message, and passing URLs to
PNGs that may not be accessible (i.e. 403 from pixiv).
2019-01-17 16:51:50 +01:00
Lonami Exo
09e58c4e53
Add more missing loggers parameters #1089
2019-01-15 11:09:08 +01:00
Lonami Exo
61593279c9
Update to v1.5.3
2019-01-14 14:26:14 +01:00
Lonami Exo
51f0bf5d84
Fully support email in edit_2fa
2019-01-14 13:57:07 +01:00
Lonami
21545c56bb
Add yet another missing file_reference
2019-01-13 20:40:51 +01:00
Lonami
be4f89740a
Fix resolve_bot_file_id for photos
2019-01-13 20:38:16 +01:00
Lonami Exo
5ac88f764d
Fix and update links in the documentation
2019-01-12 13:06:14 +01:00
Lonami Exo
fbf7f75b00
Fix send_message with buttons not always returning ReplyMarkup
2019-01-12 12:53:21 +01:00
Lonami Exo
d31aaa5d0d
Make Message.edit respect preview and buttons
2019-01-12 12:45:37 +01:00
Lonami Exo
ae4d4ba3ef
Fix-up missing loggers from f271316
2019-01-12 12:15:29 +01:00
Tulir Asokan
f271316d7d
Make logger fully configurable ( #1087 )
2019-01-11 15:52:30 +01:00
Manuel1510
eda4178333
Add hide_via to InlineResult.click ( #1084 )
2019-01-10 23:42:58 +01:00
Lonami Exo
ca2c8687c8
Expect UserEmpty on get_input_entity
2019-01-08 10:58:58 +01:00
Lonami Exo
d892a537a7
Support get_peer on participants and clarify some strings
2019-01-07 16:13:37 +01:00
Lonami Exo
e565552ae9
Update to v1.5.2
2019-01-05 17:37:52 +01:00
Lonami Exo
0a147d5b95
Add new takeout method
2019-01-05 17:18:40 +01:00
Lonami Exo
1544577757
Don't raise inside __del__ ( #1073 )
2019-01-04 11:26:57 +01:00
Lonami Exo
f99b4874c8
Support passing media objects to inline results ( #1053 )
2019-01-04 11:15:11 +01:00
Lonami Exo
4b9b77614f
Support answering inline queries with empty text ( #1053 )
2019-01-04 11:13:13 +01:00
Lonami Exo
8c0250f775
Locally check dialog's offset date ( #1043 )
...
Telegram ignores the parameter if it's alone.
2019-01-03 22:35:07 +01:00
Lonami Exo
c51a17bf9a
Actually make AdminLogEvent work
...
Ideally this would have been tested before release one commit ago.
2019-01-03 22:25:50 +01:00
Lonami Exo
77be6a2755
Update to v1.5.1
2019-01-03 19:43:48 +01:00
Lonami Exo
eda8d0dbc8
Support configuring the reply markup through buttons
2019-01-03 19:03:47 +01:00
Lonami Exo
2631144702
Add more properties to the client to make media more convenient
2019-01-03 18:34:29 +01:00
Lonami Exo
4ccabaf422
Add friendly method to get admin log ( #952 )
2019-01-03 13:09:59 +01:00
Lonami Exo
95cf873bad
Don't mark the user as connected until successfull connection
...
The idea behind distinguishing between the user being connected and
the actual connection having been made was to support retries while
the user decided to connect, even if the connection wasn't made yet.
The problem is that _user_connected is used directly to tell whether
the sender is connected or not which will be wrong if an exception
occurs on the initial connection. Since the logic retry isn't used
there we can simply mark as connected once a successfull connection
is made.
2019-01-02 10:53:10 +01:00
Lonami Exo
229969192a
Fix UnicodeDecodeError with malformed input on unparse text
2019-01-01 20:31:39 +01:00
Lonami Exo
619e4dc2d6
Fix get_peer for int which made ab557a8
useless
2018-12-28 17:54:15 +01:00
Lonami Exo
4ad9c9bf31
Add TLObject.to_json() for convenience
2018-12-27 20:15:35 +01:00
Lonami Exo
f1157b8fd1
Return downloaded bytes when file=bytes
2018-12-27 19:05:52 +01:00
Lonami Exo
342a4dd502
Update to v1.5
2018-12-25 17:55:15 +01:00
Lonami Exo
fc46e1ec20
Workaround file references by using empty byte strings for cache
...
They seem to work for now, so until there is a need to update it,
cache will just rely on empty byte strings for the file_reference.
2018-12-25 17:02:33 +01:00
Lonami Exo
b66c1e6084
Revert "Get rid of now broken cache"
...
This reverts commit f73ae42a03
.
2018-12-25 16:50:11 +01:00