Lonami Exo
278f0e9e98
Don't raise errors during disconnect
2019-05-10 18:54:10 +02:00
Lonami Exo
313caf440e
Add friendly methods for archiving dialogs
2019-05-10 18:12:16 +02:00
Lonami Exo
1828dca0b9
Support filtering by folder on iter_dialogs
2019-05-10 15:45:24 +02:00
Lonami Exo
a7443612f6
Fix download of PhotoStrippedSize to bytes
2019-05-09 18:56:54 +02:00
Lonami Exo
fbce902cf8
Fix minor documentation issue regarding pre tags
2019-05-09 14:13:43 +02:00
Lonami Exo
7f88238d8f
Update external links to the documentation
2019-05-09 14:09:22 +02:00
Lonami Exo
0a3d6106f0
Completely overhaul the documentation
2019-05-09 12:50:09 +02:00
Lonami Exo
10251f9782
Create a new Message.file property ( #1168 )
2019-05-08 18:41:40 +02:00
Lonami Exo
cfd6d3ce04
Fix catch-up when no pts is known
2019-05-08 18:15:57 +02:00
Lonami Exo
d92d989569
Quote type hints
...
Otherwise, sphinx completely butchers the documentation.
2019-05-08 17:16:09 +02:00
Lonami Exo
c6691dc6a8
Update the reference with even more types and other docs
2019-05-07 21:25:55 +02:00
Lonami Exo
8bd9dd66ab
Re-export the main modules and types from sync
...
For convenience. People can now easily replace:
from telethon import TelegramClient, events
with
from telethon.sync import TelegramClient, events
2019-05-07 10:47:25 +02:00
Lonami Exo
61613ab6ac
Create a new page with a summary of the method reference
2019-05-06 11:38:26 +02:00
Lonami Exo
744f5f50fe
Fix saving of StringSession
2019-05-06 08:55:24 +02:00
Lonami Exo
7d0efcf50f
Save pts and date only if there is something to save
2019-05-05 22:13:02 +02:00
Lonami Exo
5ed7bf7815
Fix timeout error not being excepted on Button.click
2019-05-05 19:57:09 +02:00
Lonami Exo
19398d75be
Add support for hexadecimal invite links
2019-05-05 11:56:04 +02:00
Lonami Exo
945d438696
Properly await all spawned background tasks
2019-05-04 21:02:07 +02:00
Lonami Exo
532bd1c916
Fetch difference only if it is worth it
2019-05-04 19:48:36 +02:00
Lonami Exo
f5e611e4d2
Fix SenderGetter was excepting the wrong type
2019-05-04 19:30:33 +02:00
Lonami Exo
716ab2f96d
Fix getting difference for channels and for the first time
2019-05-04 19:29:47 +02:00
Lonami Exo
adc9b4c9f1
Fix SenderGetter should not define abstract methods
...
Or at least it shouldn't if subclasses are likely to not
implement them, which causes an error if left un-implemented.
2019-05-04 17:59:21 +02:00
Lonami Exo
05fcbfd7b7
Add missing Union in hints.py
2019-05-04 12:39:48 +02:00
Lonami Exo
89c993f567
Add missing hints.py file for the previous commit
2019-05-04 10:21:21 +02:00
Lonami Exo
cd4b915522
Add type hints to all public methods in the client
2019-05-03 21:38:41 +02:00
Lonami Exo
c0e506e568
Add missing await on send_code_request
2019-05-03 21:38:41 +02:00
Lonami Exo
1e17ef1c98
Apply several lints
2019-05-03 21:38:41 +02:00
Lonami
52be689926
Only upgrade database if version < current
...
Should deal more gracefully when using new
session files in older versions of the library.
2019-05-02 23:20:39 +02:00
Lonami Exo
cb56c54351
Use the entity cache in sender getter
2019-05-02 18:51:10 +02:00
Lonami Exo
1a00de6494
Add missing checks in the message for is client None
2019-05-02 18:44:28 +02:00
Lonami Exo
b58c0d3071
Stop relying on __doc__ in EntityCache
...
This breaks when running with python -OO (optimized) which
removes the documentation but is crucial. Instead and thanks
to fce5cfea
, we can now rely on the type hints instead.
2019-05-02 10:20:49 +02:00
Lonami Exo
3a1496c205
Reuse code for _get_entity_pair
...
Less error-prone, improved the function flow for all callers,
and removed some duplicate work.
2019-05-01 17:52:32 +02:00
Lonami Exo
6d004601d0
Inline the old _load_entities code
2019-05-01 17:07:12 +02:00
Lonami Exo
e84c9847c5
Use sets instead of isinstance in StateCache too
...
Similar reasoning to the change for EntityCache, sets are faster
than attribute lookups (into types.) and isinstance (another global
lookup). Updating the state is also very common, so it should be
as fast as possible.
2019-05-01 16:37:54 +02:00
Lonami Exo
9a400748f7
Fix InlineBuilder only working with local files
2019-05-01 16:02:21 +02:00
Lonami Exo
22124b5ced
Refactor code to fetch missing entities once again
...
This is another attempt at reducing CPU usage similar to:
1b6b4a57d9
In addition it simplifies some of the code and opens up new
ideas for the state cache as well.
2019-05-01 14:02:27 +02:00
Lonami Exo
c12c65f728
Let utils.get_peer handle DialogPeer
...
This is important since some updates have a peer of
that type instead of just the normal Peer instance.
2019-05-01 12:49:36 +02:00
Lonami Exo
1dc6d226b7
Best-effort attempt at finding libssl ( #1167 )
2019-04-30 16:22:19 +02:00
Lonami Exo
1ead9757d3
Fix Conversation not allowing getting responses after ID 0
2019-04-29 08:54:10 +02:00
Lonami Exo
599a5ac3ff
Fix using events.Raw after 1b6b4a5
2019-04-29 08:54:10 +02:00
Lonami
1805dc48ec
Fix-up 3ea1c9f
no longer handling ssl being None
2019-04-28 14:13:29 +02:00
Lonami
3ea1c9f04b
Handle rare case when failing to load libssl ( #1167 )
2019-04-28 10:44:22 +02:00
Lonami Exo
1666976646
Fix-up stripped_photo_to_jpg from the previous commit
2019-04-25 20:37:48 +02:00
YoilyL
b0e96b2821
Fix stripped image downloads ( #1165 )
2019-04-25 20:31:52 +02:00
Lonami Exo
19664cd9cf
Call self._writer.wait_closed() on disconnect
...
https://docs.python.org/3/library/asyncio-stream.html#asyncio.StreamWriter.wait_closed
2019-04-25 09:56:30 +02:00
Lonami Exo
01eb49d3a4
Update to v1.7.1
2019-04-24 12:46:48 +02:00
Lonami Exo
9fc719cb24
Update download_media with a new way to save thumbs ( #1164 )
2019-04-24 12:38:03 +02:00
Lonami Exo
21aec00e46
Fix downloading photos with download_file ( #1164 )
2019-04-24 12:37:19 +02:00
Lonami Exo
1b6b4a57d9
Attempt at reducing CPU usage after c902428
...
This attempt removes the forced `await` call, which could
be causing that extra usage. Some more boilerplate is needed.
2019-04-23 20:17:43 +02:00
Lonami Exo
56595e4a9c
Treat all error codes as positive
...
This means that -500 errors will now behave like 500 errors
correctly so the -500 "No workers running" will properly be
caught and the library will retry requests by default.
2019-04-23 11:28:09 +02:00
Lonami Exo
665c844c9d
Update to v1.7
2019-04-22 20:05:45 +02:00
Lonami Exo
bb23bc0fd2
Finish update to layer 98
2019-04-22 19:05:25 +02:00
Lonami Exo
4e783728f9
Don't catch up on reconnect and fix typo
...
The feature is not ready yet.
2019-04-22 16:56:32 +02:00
Lonami Exo
8868ce14e8
Update to layer 98
2019-04-22 16:51:05 +02:00
Lonami Exo
a151d24951
Fix StateCache accessing None to_id and add logging ( #1160 )
2019-04-22 12:24:45 +02:00
Lonami Exo
fee0923dd1
Get difference for missing entities in channels too
2019-04-21 21:24:34 +02:00
Lonami Exo
c1880c9191
Fix pts from channels is different ( #1160 )
2019-04-21 13:56:14 +02:00
yegor
8edbfbdced
Fix dd mode in MTProxies ( #1157 )
2019-04-19 22:09:22 +02:00
Lonami Exo
a7b4794585
Fix telethon.sync not syncifying takeout client
2019-04-19 13:58:37 +02:00
Lonami Exo
68bf9f76f6
Fix forward_messages for a single message when using IDs
2019-04-17 08:51:21 +02:00
Lonami
4c1555cc5f
Fix iter_dialogs missing many dialogs
2019-04-16 13:00:18 +02:00
bugchecker
0b6d766f0c
Fix loading initial pts/date could be None ( #1153 )
2019-04-14 10:38:26 +02:00
Lonami Exo
6d83b16503
Fix CallbackQuery ignoring func
2019-04-13 16:42:53 +02:00
Lonami Exo
bd6c03e5f9
Rename grouped to as_album in forward_messages
...
Public comments regarding this change can be found at:
cf3a4bc658
2019-04-13 11:02:54 +02:00
Lonami Exo
20b8250037
Fix-up new sync __enter__ not handling the client directly
2019-04-13 10:55:51 +02:00
Lonami Exo
9090ede5db
Reduce __enter__/__exit__ boilerplate for sync ctx managers
2019-04-13 10:53:33 +02:00
Lonami Exo
badefcec48
Add new action method to easily send chat actions like typing
2019-04-13 10:37:23 +02:00
Lonami Exo
fadc343821
Fix catch_up pts loading and remember pts per update
2019-04-13 09:12:59 +02:00
Lonami Exo
73742633bd
Smarter grouping behaviour when forwarding messages
2019-04-11 15:18:15 +02:00
Lonami Exo
cf3a4bc658
Expose grouped parameter in forward_messages (default True)
2019-04-11 12:47:14 +02:00
Lonami Exo
9965cda968
Save pts and date in a tuple for immutability
...
This way it is easy and cheap to copy the two required values
to all incoming updates in case we need to getDifference since
the previous pts/date to fetch entities.
This is still a work in progress.
2019-04-10 21:10:34 +04:00
Lonami Exo
bec0fa414e
Add missing files for the previous commit
2019-04-09 16:55:33 +04:00
Lonami Exo
b32d8307ec
Fix sending albums not returning the sent messages ( #1151 )
2019-04-09 16:48:58 +04:00
Lonami Exo
9598e1877c
Fix _get_response_message when integers are given #1151
2019-04-09 16:31:50 +04:00
Lonami Exo
2fb560624d
Fix seeking on strings from c0828f5
when uploading files
2019-04-09 09:29:06 +04:00
Lonami Exo
29b21209bf
Force fetch sender/chat if only min information was given
2019-04-05 21:28:31 +04:00
Lonami Exo
5e5fe5876a
Fix mimetype for mp3 files
...
It was incorrectly audio/mp3, when audio/mpeg is the correct one.
This was causing sending mp3 voice notes to not work.
2019-04-04 10:10:54 +02:00
Lonami Exo
ff8349ff3f
Prevent download_profile_photo from downloading arbitrary files
...
First of all, because it shouldn't be doing that. Second, it was
buggy and was passing the tuple returned by get_input_location to
download_file which doesn't accept tuples (instead it should be
passed the photo object so that download_file could return dc_id
and input file location itself).
2019-04-03 09:51:33 +02:00
Lonami Exo
22fcdeef7f
Better get_input_entity code flow
...
Plenty of unnecessary exceptions were being raised and caught when
the input parameters were already correct. Furthermore, since
8abc7ade22
, the in-disk cache was no
longer being used (so using usernames always reached out to memory).
2019-04-03 09:41:36 +02:00
Lonami
f95933c246
Fix downloading contacts ( #1147 )
2019-04-02 14:33:41 +02:00
Lonami Exo
41e4d0f788
Let forward_messages work with messages from different chats
...
Previously it would take the first chat it found and use the IDs
of all messages, even if they belonged to different chats, resulting
in unexpected messages to be forwarded.
Another solution would be to check that all the chats are the same,
but this solves the issue more nicely and makes it more powerful.
2019-04-02 10:46:37 +02:00
Lonami Exo
a9ab3e1211
Update forward_messages to use _get_response_message
2019-04-02 10:44:42 +02:00
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
Lonami Exo
a6c3c382b4
Except MessageIdsEmptyError when getting messages by ID
...
This error may occur even when the IDs are not actually empty.
2018-12-25 12:17:24 +01:00
Lonami Exo
f73ae42a03
Get rid of now broken cache
2018-12-25 11:44:10 +01:00
Lonami Exo
382106aafb
Check g when password's prime is known to be good
2018-12-25 10:59:16 +01:00
Lonami Exo
18f457a41d
Add missing file_reference to InputDocument
2018-12-25 01:04:45 +01:00
Aaron Gallagher
b0e0bc3701
Extend new_algo.salt1 to fix edit_2fa ( #1072 )
...
The salt1 that is sent to the server requires an additional 32 bytes
of random data. It's easy to miss this requirement from reading the
tdesktop source, because this extension is done in a function called
`ValidateNewCloudPasswordAlgo`.
https://github.com/telegramdesktop/tdesktop/blob/2e5a0e056cdb40d61d487c6062bffe1a835f
6ddd/Telegram/SourceFiles/core/core_cloud_password.cpp#L210-L211
2018-12-24 21:16:09 +01:00
Lonami Exo
deb6ca0da0
Fast-path good known prime in 2fa
2018-12-24 20:17:31 +01:00
Lonami Exo
de74711e82
Implement click for KeyboardButtonGame
2018-12-24 17:56:30 +01:00
Lonami Exo
f16ed8235c
Add new is_bot method to check if the logged-in user is a bot
2018-12-24 17:32:34 +01:00
Lonami Exo
ab557a8cef
Use getUsers/getChannels with hash 0 on get_input_entity
2018-12-24 17:32:16 +01:00
Lonami Exo
46fea3fc93
Implement clearing password in edit_2fa
2018-12-24 16:30:45 +01:00
Lonami Exo
6823b6c691
Remove old code to get the hash of a password
2018-12-24 14:47:39 +01:00
Lonami Exo
d2ac7e5b0a
Actually perform all checks in 2fa
2018-12-24 14:16:50 +01:00
Lonami Exo
a623006ea0
Update 2fa code to layer 91
2018-12-24 14:10:15 +01:00
Lonami Exo
2aa089f29c
Prevent KeyError in forward_messages
2018-12-20 20:33:25 +01:00
Kyle2142
d3feaeedb2
Prevent caption=None from crashing ( #1071 )
2018-12-20 10:50:16 +01:00
Lonami Exo
7100b75598
Update to layer 89
...
This breaks edit_2fa
2018-12-18 16:37:07 +01:00
Lonami Exo
09f994c105
Except TypeError on empty access hash from 5018879
thoroughly
2018-12-18 08:39:36 +01:00
Lonami Exo
5018879f84
Raise TypeError in get_input_peer if access_hash is None
...
When auto-casting to input peers if the access hash is now None,
the ID will be used to look-up a cached access hash which will
solve some common pitfalls (using full entities when only the
input variant should and could be used).
2018-12-15 12:23:14 +01:00
Lonami Exo
7ee7b43547
Be explicit that phone numbers only work if in your contacts
2018-12-15 12:04:36 +01:00
Sister Midnight
f3013c6817
Fix ConnectionHttp SSL socket wrap ( #1064 )
2018-12-10 14:43:48 +01:00
Lonami Exo
c48d41d99d
Expect ConnectionError in the send loop
2018-12-06 16:27:09 +01:00
Lonami Exo
f9fc433c0f
Better catch_up behaviour when invalid states are present
2018-12-06 16:07:11 +01:00
Lonami Exo
40730e7862
Fix aaee092
to correct entities' offsets on stripping
2018-12-06 12:33:15 +01:00
Lonami Exo
424079aa12
Fix pts initialized as -1 not being considered
2018-12-04 21:07:18 +01:00
Lonami Exo
0b89d9d3f9
Update to v1.4.3
2018-12-04 14:09:17 +01:00
Lonami Exo
4d8f078ad9
Fix _document_by_attribute calls using cond
2018-12-03 08:49:24 +01:00
Lonami Exo
ed1bcb509f
Use InputMessageReplyTo in get_reply_message
...
This lets bots access to messages other bots sent through replies.
2018-11-29 14:21:49 +01:00
Lonami Exo
9a6f4d35f2
Fix crash on get_messages(ids=InputMessageReplyTo)
2018-11-29 14:19:56 +01:00
Lonami Exo
10b9b4b969
Handle TimeoutError on automatic reconnect
2018-11-29 13:11:34 +01:00
Lonami Exo
4a8a85d7a6
Refetch ChatAction service message to get input users
2018-11-28 18:59:49 +01:00
Lonami Exo
16dd47f5ec
Update to v1.4.2
2018-11-24 20:53:28 +01:00
Lonami Exo
d2e995ef95
Change code to recv and handle disconnections
2018-11-24 20:53:28 +01:00
Lonami Exo
09b16f96fc
Better behaviour for send_read_acknowledge
2018-11-24 20:53:28 +01:00
painor
7e168cb4fb
Remove invalid mentions from message entities ( #1049 )
2018-11-24 19:39:05 +01:00
udf
5b2cfffedc
make utils.get_peer_id raise with message about InputPeerSelf
2018-11-23 16:39:31 +01:00
udf
9362f03fd5
fix utils.get_peer not raising in some cases
2018-11-23 16:39:31 +01:00
Lonami Exo
d214c78bd0
Add missing @property decorator
2018-11-19 12:06:18 +01:00
Lonami Exo
aaee092a46
Locally strip outgoing message text respecting entities
2018-11-19 10:15:56 +01:00
Lonami Exo
d854babf22
Make HTML parser yield the correct offset and lengths
2018-11-19 09:20:13 +01:00
Lonami Exo
d6ec883cd9
Ignore iter_messages from_user unless it's a User
2018-11-19 08:55:49 +01:00
Lonami Exo
8ed3ddba31
Clarify iter_participants filter parameter in the docs
2018-11-19 08:38:31 +01:00
Lonami Exo
207d5ebdcb
Avoid packing more than 1024 messages in a single container
2018-11-19 08:29:44 +01:00
Lonami Exo
0f7c2b891a
Fix get entity by exact name since 2ca8ddb
2018-11-15 17:23:47 +01:00
Lonami Exo
924b59d735
Actually fix cancelling custom conversations from f6bc80b
2018-11-12 08:21:18 +01:00
Lonami Exo
dfab8f5e20
Avoid caching event loop in telethon.sync
...
This would cause issues when creating and setting a different
event loop from a different thread since it would use the old
loop and not the new one, solved by explicitly getting the
loop every time, although this has a slight performance hit.
2018-11-10 11:34:26 +01:00
Lonami Exo
f046d1f0a3
Fix deadlock on unexpected disconnections
2018-11-10 11:23:19 +01:00
Lonami Exo
f6bc80bc6b
Fix cancellation of custom conversation events from d474458
2018-11-08 10:08:41 +01:00
Lonami Exo
cdbd1f6193
Fix valid auth_key never being saved after switching DC
2018-11-03 18:53:26 +01:00
Lonami Exo
0fc97a3e8c
Update to v1.4
2018-11-03 12:46:19 +01:00
Lonami Exo
8e6b98669a
Get rid of full_sync
2018-11-03 12:46:19 +01:00
K900
20a8081e8e
Fix file cache when using MemorySession ( #1033 )
2018-11-01 10:29:23 +01:00
Lonami Exo
67c5572d7b
Possibly fix possible deadlock
2018-10-28 11:53:28 +01:00
painor
45999001be
Added retry_delay parameter for auto-reconnection ( #1031 )
2018-10-28 10:55:58 +01:00
Lonami Exo
24970a875a
Fix raising PasswordHashInvalid missing request arg too
2018-10-27 09:40:30 +02:00
Lonami Exo
2863eb8cc9
Fix raising local FloodWait missing request argument
2018-10-27 09:39:00 +02:00
Lonami Exo
b0e587c03d
Except expected ConnectionError in the receive loop
2018-10-26 10:36:33 +02:00
Lonami Exo
091180b32d
Except CancelledError in MTProtoSender send/recv loop
...
This way, the tasks should not end with the cancelled exception
which should get rid of the warning if any.
2018-10-25 15:54:25 +02:00
Kyle2142
eacfa226fd
Add Conversation.cancel() ( #1030 )
2018-10-25 15:37:36 +02:00
Lonami Exo
2c61c50671
Save session on connect and fix some typos
...
The session is saved upon connecting with the hope to make
sure that the authorization key gets saved to disk before
the next run.
2018-10-24 16:39:59 +02:00
Lonami Exo
4562ba9ccf
Fix auth_key not actually being saved
...
This would make the user have to login every time.
2018-10-22 20:58:07 +02:00
Lonami Exo
7dece209a0
Cancel tasks on reconnect instead of awaiting them
...
This prevents us from locking forever on any task that doesn't
rely on cancellation tokens, in this case, Connection.recv()'s
_recv_queue.get() would never complete after the server closed
the connection.
Additionally, working with cancellation tokens in asyncio is
somewhat annoying to do.
Last but not least removing the Connection._disconnected future
avoids the need to use its state (if an exception was set it
should be retrieved) to prevent asyncio from complaining, which
it was before.
2018-10-21 16:20:05 +02:00
Lonami Exo
f2e77f4030
Fix using the wrong logger in Connection
2018-10-21 16:10:09 +02:00
Lonami Exo
740a715acd
Handle empty code when starting
2018-10-21 16:05:31 +02:00
Lonami Exo
0755421fc2
Fix update loop should not disconnect causing race condition
...
When starting the client, on phone migrations, it would
disconnect twice right after connecting which would
trigger a not-connected error.
2018-10-21 16:02:13 +02:00
Lonami Exo
396ec908dd
Fix _borrow_exported_sender connection
2018-10-20 17:11:40 +02:00
Lonami Exo
39929db2b8
Patch __enter__/__exit__ specially in full_sync
2018-10-19 18:04:53 +02:00
Lonami Exo
a2bae8374e
Fix .get_entity('me') not working from c31635c
( #1024 )
2018-10-19 16:57:46 +02:00
Lonami Exo
0686ec4440
Implement after_msg_id back
2018-10-19 16:53:50 +02:00
Lonami Exo
9dc4009152
Handle the right errors
2018-10-19 14:41:50 +02:00
Lonami Exo
b93b01cb02
Fix manual BadMessageError instantiation
2018-10-19 14:02:20 +02:00
Lonami Exo
6b280dc3bd
Clarify MTProtoSender._disconnected
2018-10-19 14:01:03 +02:00
Lonami Exo
945b34b103
Set MTProtoSender.auth_key on its creation
2018-10-19 13:56:11 +02:00
Lonami Exo
8563b9560d
Fix auth_key not being set
2018-10-19 13:35:29 +02:00
Lonami Exo
939854a0dd
Fix-up e2fe3eb
(packer was OK, encryption was not made)
2018-10-19 13:33:24 +02:00
Lonami Exo
f5bc952309
Don't set the disconnected flag twice
2018-10-19 13:25:00 +02:00
Lonami Exo
e2fe3eb503
Use new broken MessagePacker
2018-10-19 13:24:52 +02:00
Lonami Exo
83f60deef9
Allow updating AuthKey.key
...
This will preserve references to the AuthKey more cleanly.
2018-10-19 12:40:36 +02:00
Lonami Exo
6d30a38316
Let Connection._disconnected be a proper Future
...
This means that awaiting on disconnect will properly raise errors,
allowing to differentiate clean disconnects from faulty ones.
2018-10-19 10:46:34 +02:00
Lonami Exo
542d0f539b
Revisit connection and properly detail the class' intent
2018-10-19 10:35:22 +02:00
Lonami Exo
e5fc9d8674
Fix several broken links in the docs
2018-10-17 11:50:11 +02:00
Lonami Exo
a9a2401e44
Fix CallbackQuery using string regex
2018-10-17 11:44:08 +02:00
Lonami Exo
419fe6dca3
Raise RuntimeError on with blocks that need async
2018-10-17 11:30:07 +02:00
Lonami Exo
9cbc088b76
Make disconnect synchronous
...
This also fixes a bug when auto-reconnecting in MTProtoSender.
2018-10-16 11:56:17 +02:00
Lonami Exo
b219da6b87
Fix Dialog.is_group for types.ChatForbidden
2018-10-15 18:43:53 +02:00
Lonami Exo
34cefed9ff
Except BotMethodInvalidError on getContacts
2018-10-15 18:42:35 +02:00
Lonami Exo
99129daeee
Show the request that caused RPC errors in their messages
2018-10-15 18:35:51 +02:00
Lonami Exo
0094eb391e
Support exclusive conversations by default
2018-10-12 22:17:07 +02:00
Lonami Exo
cf6686ff42
Revert async sessions from 3dd8b7c
(breaks sync properties)
...
Such as ChatGetter.input_chat and SenderGetter.input_sender
which rely on the fact that access to the session file will
be synchronous.
2018-10-12 22:00:02 +02:00
Lonami Exo
e677a6bb05
Fix is_user_authorized after log_out
2018-10-12 19:57:16 +02:00
Lonami Exo
6e77f583f1
Detect arbitrary negative HTTP error codes
2018-10-12 19:47:40 +02:00
Lonami Exo
74f7ae525f
Document InlineBuilder
2018-10-12 12:38:46 +02:00
Lonami Exo
9ee415749d
Fix InlineBuilder.photo/document and clearer errors
2018-10-12 11:50:36 +02:00
Lonami Exo
32c884d543
Revert d392939
and use empty tuple as a sentinel value
2018-10-08 11:33:56 +02:00
Lonami Exo
27345d5749
Work around importing sync and using full_sync
2018-10-08 11:13:24 +02:00
Lonami Exo
2d94a104d1
Syncify events too
2018-10-06 21:08:38 +02:00
Lonami Exo
ded24db3dd
Fix proxy support by removing conflicting arguments
2018-10-06 20:56:09 +02:00
Lonami Exo
8c14259728
Update documentation with new sections
2018-10-06 20:20:11 +02:00
Lonami Exo
fb9660afe0
Add missing awaits
2018-10-06 12:39:07 +02:00
Lonami Exo
67be6418b6
Remove callback parameter from custom.Button
...
Its behaviour was strange. Removing and adding an event
handler every time a message is sent is not a good idea
and it would just do more harm than good.
2018-10-05 20:54:50 +02:00
josephbiko
3dd8b7c6d1
Support async def in sessions ( #1013 )
2018-10-05 20:25:49 +02:00
Tulir Asokan
653f3c043d
Add full_sync module ( #1016 )
2018-10-05 19:59:56 +02:00
Lonami Exo
d392939018
Create a default module to use as a sentinel value
...
This looks better in the documentation than utils.Default,
cleans the utils with specific stuff like this, and users
may use it more easily.
2018-10-05 14:20:50 +02:00
Lonami Exo
0fcc2e5e52
Add autocast for InputDocument and InputChatPhoto
2018-10-05 14:11:47 +02:00
Lonami Exo
aa3f26263c
Fix timeout not accepting timedelta
2018-10-05 14:06:15 +02:00
Lonami Exo
dedbf29ca4
Fix Conversation.wait_event not resolving them (from d474458
)
2018-10-05 13:42:07 +02:00
Lonami Exo
dc77136453
Don't expect responses from ack, log send errors, remove TODOs
2018-10-05 13:26:44 +02:00
Lonami Exo
ef60ade647
Rewrite container packing to support arbitrary sizes
2018-10-05 13:26:44 +02:00
Lonami Exo
7e7bbcf4c0
Remove irrelevant TODOs and add more logging
2018-10-05 13:26:44 +02:00
Lonami Exo
a5d4e97922
Fix alternative connection modes
2018-10-05 13:26:44 +02:00
Lonami Exo
ebde3be820
Add support for proxy again
2018-10-05 13:26:44 +02:00
Lonami Exo
db83709c6b
Support connection timeout
2018-10-05 13:26:44 +02:00
Lonami Exo
0cc8bca098
Delete TcpClient
2018-10-05 13:26:44 +02:00
Lonami Exo
1b9d6aac06
Gzip only content related data
2018-10-05 13:26:44 +02:00
Lonami Exo
37b9922f64
Handle cancellation on the receive loop
2018-10-05 13:26:44 +02:00
Lonami Exo
e319fa3aa9
Handle IncompleteReadError and InvalidChecksumError
2018-10-05 13:26:44 +02:00
Lonami Exo
3fd7c33127
Fix automatic reconnect (e.g. on bad auth key)
...
This took more time than it should have to debug.
2018-10-05 13:26:44 +02:00
Lonami Exo
bc1fd9039d
Handle receiving errors
2018-10-05 13:26:44 +02:00
Lonami Exo
cf7e5d5592
Set auth_key on connection
2018-10-05 13:26:44 +02:00
Lonami Exo
21ffa2f26b
Fix DC migration and seqno
2018-10-05 13:26:44 +02:00
Lonami Exo
ac567ebf1d
Handle bad salt/msg not resending containers
2018-10-05 13:26:44 +02:00
Lonami Exo
3b1142aaca
Add back auth key generation process
2018-10-05 13:26:44 +02:00
Lonami Exo
5edc2216c7
Handle initial connection if network is down correctly
2018-10-05 13:26:44 +02:00
Lonami Exo
2d275989cb
Properly handle cancellation in _ReadyQueue
2018-10-05 13:26:44 +02:00
Lonami Exo
105bd52eee
Abstract the send queue off MTProtoSender
2018-10-05 13:26:44 +02:00
Lonami Exo
b02ebcb69b
Stop waiting for send items on disconnection
2018-10-05 13:26:44 +02:00
Lonami Exo
470fb9f5df
Make use of the MTProtoLayer in MTProtoSender
2018-10-05 13:26:44 +02:00
Lonami Exo
9402b4a26d
Create a new layer to lift encryption off the MTProtoSender
2018-10-05 13:26:44 +02:00
Lonami Exo
5daad2aaab
Actually use the new connection class
2018-10-05 13:26:44 +02:00
Lonami Exo
daf94e416b
Fix connection never receiving and missing clone method
2018-10-05 13:26:44 +02:00
Lonami Exo
2fd51b8582
Let all connection modes implement the new Connection
2018-10-05 13:26:44 +02:00
Lonami Exo
096424ea78
Create a new Connection class to work through queues
2018-10-05 13:26:44 +02:00
painor
340f5614b5
Add name mention formatting to HTML and Markdown ( #1019 )
2018-10-04 15:56:32 +02:00
Manuel1510
2468b32fc5
Implement next_offset and allow empty results in answer() ( #1017 )
2018-10-04 09:12:12 +02:00
nailerNAS
c2966297f1
Add delete method to custom.Dialog ( #1014 )
2018-09-28 15:47:24 +02:00
Lonami Exo
785071a5cd
Update to v1.3
2018-09-22 19:37:16 +02:00
Lonami Exo
ec0aa65fe1
An user -> a user
2018-09-22 19:18:42 +02:00
Lonami Exo
d5d3733fd4
Create events.register and siblings for "handler templates"
...
This can be thought of as a different approach to Flask's blueprints.
2018-09-22 12:51:58 +02:00
Lonami Exo
cb6f980277
Better autocast to InputPeerDialog and documentation
2018-09-22 10:56:37 +02:00
Lonami Exo
92c9bb12b7
Use asyncio.open_connection in the TcpClient
...
(cherry picked from commit 573fed1f512831cd9790130cc878655fef2fde98)
2018-09-19 19:03:36 +02:00
Lonami Exo
9275a9fcbb
Fix several typos and misleading docs ( #987 , #990 )
2018-09-19 17:51:18 +02:00
Lonami Exo
5e13a6f7a8
Fix-up get_message failing for UpdateInlineBotCallbackQuery
2018-09-19 16:42:22 +02:00
Lonami Exo
ac59cfa25b
Return chat from inline queries that "don't have it"
2018-09-19 16:40:35 +02:00
udf
3ef2416138
Add method to resolve inline message IDs ( #1005 )
2018-09-19 14:22:35 +02:00
Lonami Exo
db8bea3968
Fix getting messages by ID for private chats
2018-09-16 15:45:38 +02:00
Lonami Exo
4e07712b04
Return new .web_preview's .photo/.document if present in Message
2018-09-15 10:45:15 +02:00
Lonami Exo
080585da49
Support coroutine callbacks in start()
2018-09-09 16:17:20 +02:00
Lonami Exo
2f09e5c335
Support custom-callback filter for all events
2018-09-09 15:48:54 +02:00
Lonami Exo
11ef4ce370
Fix _document_by_attribute failing on empty media
2018-09-06 15:41:04 +02:00
Lonami Exo
4e5b8c9c34
Let sender = chat for messages from channels
2018-09-06 10:33:56 +02:00
Lonami Exo
ae085f30a8
Save update state upon disconnect
2018-09-04 11:58:55 +02:00
Lonami Exo
3c92f6a791
Fix sqlite's conn may be None if never used
...
This happened when signing up with the library
and getting migrate errors.
2018-09-04 11:28:01 +02:00
Lonami Exo
bbeb8f4ba3
Clarify and fix some docstrings
2018-09-04 11:27:10 +02:00
Wirtos
36df6d1bf9
Manually register ogg mimetype too ( #973 )
2018-08-28 21:17:10 +02:00
Lonami Exo
0e91fc3668
Manually register webp mimetype
...
Otherwise, sending stickers would fail on some systems.
2018-08-27 17:19:10 +02:00
Lonami Exo
8a9650f131
Fix-up previous commit 0bb0d0b
missing parameter
2018-08-27 10:58:06 +02:00
Lonami Exo
576ac666d9
Fix resolving events while disconnected
2018-08-27 01:20:01 +02:00
Lonami Exo
5ca1edb228
Return the correct entity from .get_entity(username)
...
The precedence of the or operator made the check succeed always
out of pure luck, since `''.lower()` would never be the chosen
username, but a present username is truthy.
This presumably worked because Telegram only returns one result
from the call, or puts the right entity the first one.
2018-08-26 12:00:17 +02:00
s3mple
29d122e810
Fix-up previous commit f17d7e9
( #967 )
2018-08-24 19:50:55 +02:00
s3mple
f17d7e9c5e
New exception class for multiple errors ( #965 )
2018-08-24 18:25:58 +02:00
Lonami Exo
52a4327769
Fix MemorySession file caching
2018-08-22 16:21:22 +02:00
Lonami Exo
8e62f797bb
Support custom encoding for StringSession
2018-08-22 16:12:27 +02:00
s3mple
aa9bc9080f
Support custom symbol set for aggressive get_participants
2018-08-21 17:15:35 +02:00
Lonami Exo
fbc46bd388
Use loop.create_future instead asyncio.Future
2018-08-21 12:22:06 +02:00
Lonami Exo
d3a6822fc9
Properly resolve events
2018-08-21 12:18:12 +02:00
Lonami Exo
47190d7d55
Fix event loop not being passed into many asyncio calls
2018-08-21 11:31:14 +02:00
Lonami Exo
d474458136
Simplify event resolving logic
...
Although this commit introduces a race condition since an
event may only be half-resolved. A lock is thus needed,
but it depends on an event-loop to which we don't have
access in the class-level.
2018-08-21 11:08:08 +02:00
Lonami Exo
9f237cc928
Simplify event building logic
...
This will also fix some bugs where the event type being accessed
would not be available, since it is now built on-demand, without
the need to keep track for the count of each event type.
2018-08-21 10:27:12 +02:00
Lonami Exo
f0cd1fdd6e
Don't disconnect sender on cancellation ( #958 )
...
This was causing a "race condition" where the sender would
be disconnected after cancellation when another was created.
2018-08-20 14:59:17 +02:00
Lonami Exo
171e13daa9
Special case File responses without parent request ( #658 )
2018-08-20 11:42:51 +02:00
Lonami Exo
dda1f0b1dd
Stop copying reply when resending Message, fix file replies
2018-08-19 11:49:36 +02:00
Lonami Exo
f4b9c9d6d4
Remove critical code from assert statements
2018-08-14 19:14:13 +02:00
Lonami Exo
7efa53fedf
Update to v1.2
2018-08-14 18:48:56 +02:00
Lonami Exo
06da651f27
Fix edits in custom.Conversation
2018-08-14 18:42:16 +02:00
Lonami Exo
216805d62d
Fix telethon.sync for custom.Conversation
2018-08-14 18:41:13 +02:00
Lonami Exo
653686996a
Revisit catch_up ( #808 )
2018-08-13 12:32:12 +02:00
Lonami Exo
d3efc8f57d
Better logging for packing errors
...
https://github.com/expectocode/telegram-export/issues/76
2018-08-08 12:04:20 +02:00
Lonami Exo
e3bf6e3330
Document reply markup limits
2018-08-07 12:46:05 +02:00
Lonami Exo
9195bccb41
Fix sending files from disk after 6d1bc22
( #941 and #943 )
2018-08-06 18:03:42 +02:00
Lonami Exo
44558cc592
Add utils.resolve_bot_file_id inverse
2018-08-06 17:54:07 +02:00
Lonami Exo
f332e4c423
Clearer variable naming
2018-08-06 16:31:15 +02:00
Lonami Exo
f39f9a94b5
Remove unnecessary async/await
2018-08-06 16:30:25 +02:00
Lonami Exo
d3a9dcd36c
Replace wait code with asyncio.wait_for and pass the client's loop
2018-08-06 16:22:11 +02:00
Lonami Exo
8ce001318e
Fix StringSession(None)
2018-08-05 19:45:56 +02:00
Lonami Exo
0011f19f8b
Create a StringSession
2018-08-05 16:24:34 +02:00
Lonami Exo
63174ae404
Properly clean-up Conversation
2018-08-05 13:15:19 +02:00
Lonami Exo
26bcc78d14
Fix Conversation.get_response
2018-08-05 12:28:54 +02:00
Lonami Exo
cc067b2569
Add Conversation to the sync magic module
2018-08-05 11:05:01 +02:00
Lonami Exo
48113851a8
Fix built Conversation events don't have the client
2018-08-05 02:01:06 +02:00
Lonami Exo
ca40a9c282
Add Conversation.wait_event
2018-08-05 01:55:41 +02:00
Lonami Exo
1ecb751222
Add Conversation.send_file and .mark_read
2018-08-04 23:21:19 +02:00
Lonami Exo
396b1a4177
Improve getting edits in a Conversation
2018-08-04 15:35:51 +02:00
Lonami Exo
5f73482d29
Restart Conversation total timeout upon __aenter__
2018-08-04 15:35:04 +02:00
Lonami Exo
a688c8a4ce
Fix exception ignored warnings and invalid state #935
2018-08-04 15:06:11 +02:00
Nikolay Tretyak
d0c566bbdb
Fix iter_participants is failing when _total is None ( #936 )
2018-08-04 11:30:24 +02:00
Lonami Exo
2cf95ce2b9
Fix accessing buttons on messages with reply markup
2018-08-04 11:16:51 +02:00
Lonami Exo
c1d67f35c9
Fix creating unknown RPCError messages with known code failing
2018-08-04 00:43:53 +02:00
Lonami Exo
785ef7676f
Create a basic custom.Conversation
2018-08-03 17:51:56 +02:00
Lonami Exo
60c61181d9
Return custom.InlineResults instead of a simple list
2018-08-02 23:31:51 +02:00
Lonami Exo
7cce7aa3e4
Return helpers.TotalList instances on client.get_ methods
2018-08-02 23:00:10 +02:00
Lonami Exo
070c971d11
Set media as None if it is MessageMediaEmpty
2018-08-02 20:18:28 +02:00
Lonami Exo
f4ea662fdd
Fix sign in not saving self user to session file
2018-08-02 19:40:48 +02:00
Lonami Exo
7a7923b317
Fallback to MemorySession if sqlite3 is not available
2018-08-02 15:17:44 +02:00
Lonami Exo
16f7626ceb
Fix custom.Button._is_inline failing for MessageButton
2018-08-02 14:53:26 +02:00
Lonami Exo
3612652f39
Use builtin base64.urlsafe_b64decode and fix docstring
2018-08-02 13:59:27 +02:00
Lonami Exo
2ca8ddbfb4
Use cache for invite links
2018-08-02 13:47:35 +02:00
Lonami Exo
328f737ef7
Support custom.MessageButton as buttons reply markup
2018-08-02 13:17:59 +02:00
Lonami Exo
10da14418c
Create utils.get_peer
2018-08-02 12:56:40 +02:00
Lonami Exo
80a5e709cb
Support .download_media with bot API file_id
2018-08-01 13:40:07 +02:00
Lonami Exo
e359b428c3
Merge branch 'inlineresult'
2018-08-01 01:06:59 +02:00
Lonami Exo
7a2d7d98ad
Implement client.inline_query()
2018-08-01 01:06:47 +02:00
Lonami Exo
49a6cb4ef8
Fix InlineResult.click()
2018-08-01 01:06:08 +02:00
Lonami Exo
76c7217000
Support downloading web documents
2018-08-01 00:37:25 +02:00
Lonami Exo
7d880a856e
Implement InlineResult.download_media
2018-08-01 00:15:23 +02:00
Lonami Exo
6d1bc227aa
Support bot API file_id on send_file
2018-07-31 23:35:22 +02:00
Lonami Exo
972950fc2e
Create utils.resolve_bot_file_id
2018-07-31 23:35:07 +02:00
Lonami Exo
638eeb3c82
Fix attributes not being inferred for open()ed files
2018-07-31 12:14:13 +02:00
Lonami Exo
f0a26d7c76
Implement global search ( closes #920 )
2018-07-29 23:16:22 +02:00
Lonami
223b007a55
Fix get_message_id after custom message patch
2018-07-29 15:49:12 +02:00
Lonami Exo
96742334a4
Fix incoming = outgoing = True not working
2018-07-29 13:03:10 +02:00
Lonami Exo
682e650187
Create a basic InlineResult class
2018-07-29 12:56:11 +02:00
Lonami Exo
cc4c620261
Show more information for bare RPCError ( #919 )
2018-07-29 12:40:40 +02:00
Lonami Exo
f2c8663266
Fix copy pasted docs and snake_case files
2018-07-28 11:28:02 +02:00
Lonami Exo
26f121060d
Always support aggressive in iter_participants ( #904 )
2018-07-25 12:40:49 +02:00
Lonami Exo
7729a2a78f
More logging for bad messages ( #907 )
2018-07-25 12:33:12 +02:00
Lonami Exo
b3990546eb
Fix RPCError may occur for no parent message ( #908 )
2018-07-25 12:19:28 +02:00
Lonami Exo
7b4cd92066
Revert 030f292
(use libssl if available)
2018-07-25 12:11:58 +02:00
Lonami Exo
200a4e47b8
Clarify some strings
2018-07-25 02:21:44 +02:00
Lonami Exo
7b22c72c3e
Use UTC timezone for events.UserUpdate
2018-07-24 20:38:38 +02:00
Lonami Exo
6c51c35ccf
Fix _iter_ids not expecting InputChannel
2018-07-24 18:20:34 +02:00
Lonami Exo
7778b665db
Update to v1.1.1
2018-07-23 12:44:46 +02:00
Lonami Exo
d8fa0c81f6
Fix-up 52292d7
accessing types under the wrong module
2018-07-23 12:19:41 +02:00
Lonami Exo
056842d1a0
Fix trailing comma breaking Python 3.5.2 compat
2018-07-23 12:18:35 +02:00
Lonami Exo
52292d77fb
Use types. namespace in utils
2018-07-22 19:40:00 +02:00
Lonami Exo
ace7254344
Fix classes MRO and abstractmethod usage
...
Furthermore utils needs to access the message by reference
through types.Message because it is patched and replaced.
2018-07-22 19:26:34 +02:00
Lonami Exo
1c0d595205
Replace custom.Message creation with ._finish_init
2018-07-22 19:20:55 +02:00
Lonami Exo
fd17098447
Rename MessageBase for Message
2018-07-22 17:22:52 +02:00
Lonami Exo
c4e94abcf0
Complete moving properties to the new message base
2018-07-22 16:49:42 +02:00
Lonami Exo
a3ac6d1645
Create a common message base class
2018-07-22 13:26:12 +02:00
Lonami Exo
5df46f9ed8
(Try to) fix infinite recursion in custom.Message again
2018-07-22 12:27:08 +02:00
Lonami Exo
bc03c29216
Fix logical bugs when getting input peers in custom.Message
...
Such as incorrectly handling InputPeerSelf/InputPeerChat and
using self._input_sender when self._input_chat was expected.
2018-07-22 11:33:29 +02:00
Lonami Exo
e4963237dc
Fix-up a332d29
should not be exported on invalid DC
2018-07-22 01:08:03 +02:00
Lonami Exo
a332d29c4c
Fix-up 5a9a00e
to handle exporting senders to the same DC
2018-07-22 00:40:39 +02:00
Lonami Exo
46b2d910d7
Fix logging of functools.partial() callbacks
2018-07-21 17:52:42 +02:00
Lonami Exo
3d7bff64c2
Update to v1.1
2018-07-21 15:29:09 +02:00
Lonami Exo
3bdfd4b32c
Make build_reply_markup public
2018-07-21 13:55:26 +02:00
Lonami Exo
7750c9ff2f
Make sure to not add callbacks from buttons= twice
2018-07-21 13:24:32 +02:00
Lonami Exo
24758b82ec
Don't make a request at all if it will trigger flood wait
2018-07-21 12:25:20 +02:00
Lonami Exo
a9cc35e604
Avoid triggering FileMigrateError when possible
2018-07-21 11:59:44 +02:00
Lonami Exo
5a9a00e7ae
Assume exported auths last forever
...
This implies that export senders will NOT be deleted from
memory once all borrows are returned, thus their auth_key
remains as well. When borrowing them if they existed they
will be connect()ed if it's the first borrow.
This probably fixes #901 .
2018-07-21 11:24:20 +02:00
Lonami Exo
13437cc3f2
Fix infinite recursion for custom.Message.message
2018-07-21 10:19:17 +02:00
Lonami Exo
aa67f107af
Temporarily use blocking SSL sockets on connect
2018-07-19 20:56:45 +02:00
Lonami Exo
4027ac6a6f
Wrap socket with SSL after connecting
...
See https://github.com/Anorov/PySocks/issues/29
2018-07-19 20:38:53 +02:00
Lonami Exo
7f78d7ed2f
Use classmethod for all Event.build
2018-07-19 01:47:32 +02:00
Lonami Exo
2d7c8908eb
Create events.InlineQuery
2018-07-15 11:31:24 +02:00
Lonami Exo
5017a9d1da
Fix typos and add the URL_INVALID error
2018-07-14 10:43:24 +02:00
Lonami Exo
dc3d281274
Load update state date with explicit timezone ( #808 )
2018-07-14 00:01:45 +02:00
Lonami Exo
051d56af88
Support clicking buttons known their data
2018-07-12 16:26:22 +02:00
Lonami Exo
22c8fd7378
Fix Updates object being dispatched to user handlers
2018-07-12 09:45:29 +02:00
Lonami Exo
38c65adf35
Set timezone info when reading datetimes
2018-07-12 00:30:57 +02:00
Lonami Exo
8b4c8d30e7
Fix events.MessageDeleted setting readonly properties
2018-07-11 11:34:20 +02:00
Lonami Exo
4f5c6f1006
Merge branch 'event-reusing'
2018-07-11 11:31:46 +02:00
Lonami Exo
e2ffa816dc
Fix infinite recursion
2018-07-11 11:23:11 +02:00
Lonami Exo
1d0fd6801d
Build events only once per update
2018-07-11 11:22:43 +02:00
Lonami Exo
81f31e09c8
Keep track of how many events for each type were added
2018-07-11 10:50:19 +02:00
Lonami Exo
e902304360
Expose silent parameter when sending messages
2018-07-11 10:16:21 +02:00
Lonami Exo
a3d6baf408
Actually add callbacks registered through Button
2018-07-10 19:50:18 +02:00
Lonami Exo
f6c45dcc63
Support filtering events.CallbackQuery
2018-07-10 17:59:13 +02:00
Lonami Exo
ea07cf8d12
Add buttons parameter to client.edit_message
2018-07-10 17:59:13 +02:00
Lonami Exo
05e8e60291
Create events.CallbackQuery
2018-07-10 17:59:13 +02:00
Lonami Exo
8eecd9c226
Reuse code to get chat and sender
2018-07-10 17:59:13 +02:00
Lonami Exo
531a02a2a1
Support buttons when sending a file too
2018-07-10 17:59:13 +02:00
Lonami Exo
8c28be04bc
Create a custom.Button class and support send_message(buttons=...)
2018-07-10 17:59:13 +02:00
Lonami Exo
a50d013ee6
Support interactively signing in as a bot
2018-07-10 17:59:13 +02:00
Lonami
ac5f8da50c
Fix update.pts may be None
2018-07-10 16:59:40 +02:00
josephbiko
e6981e7676
Remove empty except ( #887 )
2018-07-09 20:54:43 +02:00
Lonami Exo
4328663c78
Support timedelta as datetimes
2018-07-09 13:36:52 +02:00
Lonami Exo
1437b69829
Update to v1.0.4
2018-07-09 12:32:47 +02:00
Lonami Exo
1b22d0eb12
Add missing await
2018-07-08 23:44:56 +02:00
Lonami Exo
7b6e65a7a5
Re-export ConnectionHttp from the network package
2018-07-08 17:48:38 +02:00
Lonami
128053750d
Implement HTTP(S) mode ( closes #112 ) ( #883 )
2018-07-08 17:45:49 +02:00
Lonami Exo
e0513e10df
Remove debug print
2018-07-08 15:24:33 +02:00
Lonami Exo
3a9cce8720
Add missing async/await to events' documentation
2018-07-08 15:11:10 +02:00
Lonami Exo
d02cb84abe
Fix end of sync with block warning on disconnect
2018-07-08 00:05:09 +02:00
Lonami Exo
54bffb30d8
Fix send_message('me', Message)
2018-07-08 00:05:09 +02:00
Lonami Exo
cb3846cb7f
Add client.get_peer_id
2018-07-07 12:45:50 +02:00
Lonami Exo
3b3b148a43
Revert add_mark parameter on utils.get_peer_id
...
And a fix for -1000 IDs that wasn't being accounted for.
2018-07-07 12:44:21 +02:00
Lonami Exo
bb4ed4019f
Revert forward_messages requiring named from_peer arg
2018-07-07 12:14:50 +02:00
Lonami Exo
bd878acbde
Support InputNotifyPeer autocast
2018-07-07 12:14:03 +02:00
Lonami Exo
dfda61a1b5
Correct thumb parameter documentation
2018-07-07 12:01:42 +02:00
Lonami Exo
393e1966c7
Avoid exceeding maximum container size
...
This issue would likely be triggered when automatically
merging multiple requests into a single one while having
their size exceed 1044456 bytes like SaveFilePartRequest.
This commit avoids such issue by keeping track of the
current size, and if it exceeds the limit, avoid merge.
2018-07-07 11:58:48 +02:00
Lonami Exo
33ce702ab9
Pre-pack outgoing TLMessage
...
This has several benefits:
- The message can be resent without re-calling bytes(),
which for some requests may be expensive.
- Converting requests to bytes early lets us detect
errors early, such as OverflowError on bad requests.
- Containers can't exceed 1044456 bytes so knowing their
length is important. This can now be done in O(1).
But also several drawbacks:
- If the object is modified the bytes won't reflect this.
This isn't an issue because it's only done for in msgs.
- Incoming messages can no longer be reconverted into
bytes but this was never needed anyway.
2018-07-07 11:46:21 +02:00
Lonami Exo
b237947af1
Update to v1.0.3
2018-07-04 15:41:11 +02:00
Lonami Exo
44630542d0
Fix MessageAction not allowing access to media
...
This caused some issues with events.MessageEdited because
some MessageAction can trigger these edit updates such as
scoring in a game.
2018-07-03 14:13:44 +02:00
Lonami Exo
43afdb9d77
Fix-up 53fbfb2
for InputPeerChat or others
2018-07-03 14:05:42 +02:00
Lonami Exo
53fbfb215f
Fix Telegram may omit entities' access hash in updates
2018-07-02 18:43:42 +02:00
Lonami Exo
53c660d0dc
Don't remove reader if fd == -1
2018-06-30 13:26:28 +02:00
Harry
dfcf414111
Fix hachoir don't close files by itself ( #875 )
2018-06-29 16:45:18 +02:00
Lonami Exo
baedd10110
Update to layer 82
2018-06-29 13:23:56 +02:00
Lonami Exo
dd0eb7a90e
Explicitly open files as 'r' instead of leaving it out
2018-06-29 11:34:57 +02:00
Lonami Exo
d64eb7ea2b
Avoid cyclic imports on older Python versions
2018-06-29 11:04:42 +02:00
Lonami Exo
3c2ff45b0b
Support dispatching updates in a sequential order
2018-06-29 10:45:04 +02:00
Lonami Exo
0f737a86af
Revert sign_in needing named code argument
2018-06-29 09:57:57 +02:00
Lonami Exo
dbca38c6f5
Allow iterating over messages in reverse
2018-06-28 21:15:29 +02:00
Lonami Exo
ac6dbb8a5c
Fix is_connected accessing unexisting property
2018-06-28 16:04:12 +02:00
Lonami Exo
0f5f6cc050
Fix opposite condition
2018-06-28 15:50:26 +02:00
Lonami Exo
cedf90eb57
Update to v1.0.2
2018-06-28 15:37:30 +02:00
Lonami Exo
ac2b10f2a5
Stop using loop's time() function
2018-06-28 15:12:18 +02:00
Lonami Exo
491302bb32
Fix parallel downloads when using exported senders
2018-06-28 14:10:36 +02:00
Lonami Exo
fb40e7b508
Update mtprotoplainsender.py asserts
2018-06-28 09:48:03 +02:00
Lonami Exo
3154575ab6
Update to v1.0.1
2018-06-27 19:55:37 +02:00
Lonami Exo
a6782ac6ea
Send getState upon successful reconnection
2018-06-27 19:40:32 +02:00
Lonami Exo
c0412e4410
Fix run_until_disconnected disconnect with telethon.sync
2018-06-27 19:39:47 +02:00
Lonami Exo
ad01bda503
Fix custom.Message.buttons being None in channels ( #870 )
...
The implications behind this were bigger than expected. The sender
of the message is not actually needed for anything in the bot. The
bot itself may be needed, but only for KeyboardButtonSwitchInline.
2018-06-27 19:25:14 +02:00
Lonami Exo
18f06f1a25
Fix bad notification due to wrong system clock never ending
2018-06-27 19:04:33 +02:00
Inokenty
f014c040a3
Keyword arg instead positional for sign_in ( #869 )
2018-06-27 17:23:46 +02:00
Lonami Exo
a46a45d060
Don't disconnect on del if already disconnected/loop closed
2018-06-27 13:57:17 +02:00
Lonami Exo
72835dfb44
Update to v1.0
2018-06-27 13:41:20 +02:00
Lonami Exo
4be248932d
Fix non-ending awaits due to requests not being resent on reconnect
2018-06-27 10:26:26 +02:00
Lonami Exo
58aadce5ba
Fix-up 2b090f8
not actually resaving new auth_keys
2018-06-27 10:15:59 +02:00
Lonami Exo
e604960a1d
Include TAKEOUT_INIT_DELAY_X in the available errors
2018-06-27 09:46:14 +02:00
Lonami Exo
75865cbaa8
Syncify async generators too
2018-06-27 09:34:35 +02:00
Lonami Exo
8c5bbdf7eb
Check from_user client-side for PMs in iter_messages
2018-06-26 16:48:03 +02:00
Lonami Exo
09ea8ffe0b
Fix send_file completely ignoring input parameters
2018-06-26 16:39:43 +02:00
Lonami Exo
2bd0c6c525
Support URLs on send_file
2018-06-26 16:39:22 +02:00
Lonami Exo
2b090f8888
Fix connect not saving different authkeys
2018-06-26 16:20:30 +02:00
Lonami Exo
9159e2a720
Remove report_errors/flood_sleep_threshold from the session
2018-06-26 16:09:16 +02:00
chrizrobert
1eb4af33df
Fix get_entities_text with cls ( #866 )
2018-06-26 15:58:55 +02:00
Lonami Exo
dbb81173fa
Add an assistant bot example
2018-06-26 15:48:56 +02:00
Lonami Exo
6152e33454
Fix sync run_until_disconnected not liking Ctrl+C
2018-06-26 15:48:38 +02:00
Lonami Exo
f6bfcad49e
Don't close session file on _switch_dc disconnect
2018-06-26 13:37:34 +02:00
Lonami Exo
3556d5ed79
Fix-up 9971145
still accessing unexisting properties
2018-06-26 13:15:25 +02:00
Lonami Exo
96e8b0b840
Remove get_fwd_sender
2018-06-26 12:38:58 +02:00
Lonami Exo
9971145721
Assert properties exist on disconnect
2018-06-26 12:03:31 +02:00
Lonami Exo
19900a373a
More useful messages from authenticator.py
2018-06-26 11:32:09 +02:00
Lonami Exo
32786d16fd
Support using the client in with blocks
2018-06-26 11:26:01 +02:00
Lonami Exo
d4b508bf48
Fix __del__ with sync magic
2018-06-26 11:23:51 +02:00
Lonami Exo
75dc4809f5
Remove all deprecated methods
2018-06-26 11:10:11 +02:00
Lonami Exo
a43c6c2b68
Work around Python 3.5.2 bug causing 100% CPU load on script's end
2018-06-26 11:10:11 +02:00
Lonami Exo
f295ea668a
Make sync.syncify a public function for user types
2018-06-26 11:10:11 +02:00
Lonami Exo
044e6e8a85
Await updates task to finish upon disconnect
2018-06-26 11:10:11 +02:00
Lonami Exo
fc834f60fb
Fix custom.Dialog passing the wrong instance to custom.Draft
2018-06-25 21:24:46 +02:00
Lonami Exo
d65f8ecc0d
Document the magic sync module
2018-06-25 21:14:58 +02:00
Lonami Exo
551b0044ce
Reuse more code using sqlite's cursor
2018-06-25 20:11:48 +02:00
Lonami Exo
313bead615
Close sqlite's cursor after usage
2018-06-25 19:49:33 +02:00
Lonami Exo
4da50ba3a0
Add a syncify magic module to use asyncio as sync
2018-06-25 14:24:56 +02:00
Lonami Exo
9c6d2894fc
Allow start when the loop is not running
2018-06-25 13:42:29 +02:00
Lonami Exo
db5cb74bdd
Allow run_until_disconnected when the loop is running
2018-06-25 13:32:31 +02:00
Lonami Exo
c1046c2acc
Fix "user joined" being "user added itself"
2018-06-25 13:21:23 +02:00
Lonami Exo
59f6b75391
Stop showing "data left after" warning
2018-06-25 12:54:33 +02:00
Lonami Exo
410518aa65
Stop using await with properties
2018-06-25 11:38:56 +02:00
Lonami Exo
0d09f9d8c1
Create a custom.Forward class
2018-06-25 11:34:10 +02:00
Lonami Exo
efc9f4c414
Get rid of all remaining async properties
2018-06-25 11:03:20 +02:00
Lonami Exo
ae47fd37b0
Update to v1.0-rc1
2018-06-24 15:51:24 +02:00
Lonami Exo
266d44dd86
Fix EventsCommon still having async properties
2018-06-24 13:05:58 +02:00
Lonami Exo
d4479a0a4e
Save the session file less often
2018-06-24 12:21:58 +02:00
Lonami Exo
184424957d
Create a separate method to start reconnections
2018-06-24 10:44:31 +02:00
Lonami Exo
0d0e78e10b
Use the right chat peer in private messages
2018-06-23 15:10:07 +02:00
Lonami Exo
51da48ddd2
Support custom parse_mode to use MessageEntityMentionName
2018-06-22 16:18:23 +02:00
Lonami Exo
3d3698562b
Cleanly handle KeyboardInterrupt in run_until_disconnected
2018-06-22 13:26:24 +02:00
Lonami Exo
1a1d9d346c
Fix most private messages being outgoing since 56ddaae
...
56ddaae
checked to_id and from_id to compare if they were equal,
and if they were, mark the event as outgoing for convenience in
your private chat (saved messages).
However when reconstructing the Message from UpdateShortMessage
to_id didn't mimic 100% Telegram's behaviour (the chat to which
the message is sent is "different" depending on who sent the
messages). This bug is what actually caused most messages to
be outgoing, even though 56ddaae's logic is correct.
2018-06-22 10:25:20 +02:00
Lonami Exo
8d98c04932
Fix awaits on input_chat property
2018-06-22 10:05:29 +02:00
Lonami Exo
f733f8e565
Rewrite the first part of the docs for asyncio
2018-06-21 21:54:54 +02:00
Lonami Exo
5e322a6ca9
Remove async properties from custom.Message
...
Awaiting on a property was strange and only really made sense
in events.NewMessage. Methods like client.get_messages() and
similar return entire custom.Message which won't need to touch
the network, and requiring the await was a poor UX.
2018-06-21 21:15:48 +02:00
Lonami Exo
3973755333
Support .name attr in utils.is_type/client.upload_file
...
This means open()'ed files will have their name used properly,
and that you can set b.name = 'somename.jpg' to io.BytesIO()
objects to have them uploaded as images.
2018-06-21 16:31:03 +02:00
Lonami Exo
d8af64e3b9
Clarify/fix get[_input]_entity docstrings
2018-06-21 11:08:14 +02:00
Lonami Exo
5c602d4ba7
Add __str__ to RpcResult/GzipPacked
2018-06-21 09:58:12 +02:00
Lonami Exo
a99fce471a
Fix cancelling a None handle on first connection+error
2018-06-21 09:48:11 +02:00
Lonami Exo
cfa5cd0db2
Fix is_user_authorized always returning True
2018-06-21 09:32:09 +02:00
Lonami Exo
8d5c052fce
Fix TypeError when accessing unexisting sender
2018-06-21 09:26:31 +02:00
Lonami Exo
d6818f25f5
Fix rare iter_dialogs infinite loop
2018-06-20 21:12:47 +02:00
Lonami Exo
9c0a22ddd7
Fix Python 3.5 compatibility
2018-06-20 20:18:16 +02:00
Lonami Exo
9e3f6483e8
Fix pattern= and move pattern_match to events.NewMessage
2018-06-20 20:03:44 +02:00
Lonami Exo
a1477a84bf
Update in-memory updates.State
2018-06-20 19:58:01 +02:00
Lonami Exo
4ab5c7d92d
Fix reconnect sentinel when not reconnecting in send_loop
...
It would cause issues with the debug logs, since it assumes it's
a TLMessage, which have an .obj attribute. Second, the send_loop
is also smarter regarding reconnects (since OSError often occur
due to not being connected at all, namely ConnectionResetError).
2018-06-20 18:19:57 +02:00
Lonami Exo
c8ee0bdca9
Fix socket may be None when closing twice
2018-06-20 17:59:11 +02:00
Lonami Exo
a0eb824e87
Support ignore_migrated in iter_dialogs
2018-06-20 12:03:42 +02:00
Lonami Exo
c893eaaa84
Allow filtering new messages by sender/forwards
2018-06-20 11:58:44 +02:00
Lonami Exo
ad1ab64415
Save last ack to resend in case of bad salt
2018-06-20 11:12:04 +02:00
Lonami Exo
c85ba4accc
Revisit documentation, cross-references and unnecessary indents
2018-06-20 11:06:03 +02:00
Lonami Exo
4e9a84c3b5
Remove underscore from module names
2018-06-18 21:02:42 +02:00
Lonami Exo
262018959f
Process entities from sent requests/updates
2018-06-18 20:44:20 +02:00
Lonami Exo
fbf3bf119c
Separate errors needing regex from those which don't
2018-06-18 19:09:45 +02:00
Lonami Exo
463847ad50
Revisit and remove a few TODOs
2018-06-18 18:46:06 +02:00
Lonami Exo
ebfe8ebf40
Configurable per-client request/connection retries
2018-06-18 18:13:00 +02:00
Lonami Exo
09ea1179ca
Except msg_id KeyError on bad salt/msg
2018-06-18 17:20:31 +02:00
Lonami Exo
3648f7c756
Log outgoing message types and incoming message IDs
2018-06-18 17:14:04 +02:00
Lonami Exo
51d8ea0fa8
Shield disconnected Future in the MTProtoSender instead
2018-06-18 15:55:24 +02:00
Lonami Exo
efc48ee3b0
Shield self.disconnected and log RpcCallFail
2018-06-18 14:28:30 +02:00
Lonami Exo
ee7a44d447
Return an empty list from get_entities_text if no entities
2018-06-18 13:54:09 +02:00
Lonami Exo
3c1d7d2da2
Fix MessageEmpty when searching for messages
2018-06-18 13:48:50 +02:00
Lonami Exo
7641ba2d32
Fix sleep on the wrong indent and handle CancelledError
...
This was causing a huge slow-down every time a request was
received delaying all the subsequent incoming messages too
2018-06-18 13:29:12 +02:00
Lonami Exo
374f5e2aab
Periodically send ping/getState
2018-06-18 13:22:25 +02:00
Lonami Exo
94d6c339c4
Add more logging in the MTProtoSender
2018-06-18 11:29:54 +02:00
Lonami Exo
e36aff51dd
Raise ConnectionError when sending without connection
...
Otherwise the program could potentially block on await client(...)
since this has no timeout (unless asyncio.wait_for() was used) and
would give no further hint that the program was halted there.
2018-06-17 20:25:22 +02:00
Dan Elkouby
d5b349e031
Implement a mechanism to notify of connection failures ( #852 )
2018-06-17 19:29:41 +02:00
Lonami Exo
d9d586171f
Fix MTProtoSender should not send content-related queries
2018-06-17 16:23:22 +02:00
Lonami Exo
145d4b7105
Remove socket fd from the loop reader upon closing
2018-06-17 15:48:26 +02:00
Lonami Exo
aaa7ec757b
Support start() retrying on PasswordHashInvalidError
2018-06-17 14:07:45 +02:00
Lonami Exo
4d1272f1d2
Fix __ is invalid in usernames (cc @Kyle2142)
2018-06-17 12:08:55 +02:00
Lonami Exo
b65cbd8647
Validate to_id when iterating over messages by ID
2018-06-17 11:57:11 +02:00
Lonami Exo
226c35ff8f
Pump up default timeout from 5 to 10s
2018-06-17 11:46:56 +02:00
Lonami Exo
d18ee9ecc5
Handle (re)connection errors more gracefully
2018-06-17 11:41:35 +02:00
Lonami Exo
8086772506
Make sure not to include sentinel in containers
2018-06-16 18:40:08 +02:00
Lonami Exo
bb2cacd525
Fix automatic reconnection by unblocking the send queue
2018-06-16 18:34:36 +02:00
Lonami Exo
56ddaaee6f
Make non-fwded messages sent to yourself outgoing
2018-06-16 17:35:24 +02:00
Lonami Exo
7cfecfaf21
Support pathlib.Path on download/upload
2018-06-16 17:01:20 +02:00
Lonami Exo
cbd5594dba
Use the correct clock time when sleeping on iter_messages
2018-06-15 17:09:16 +02:00
Lonami Exo
509fba8bcc
Fix-up isinstance/is_user_authorized from 06cdf1f
2018-06-15 13:01:16 +02:00
Lonami Exo
b7286be3b0
Get the "correct" chat in private incoming messages
2018-06-15 12:46:41 +02:00
Lonami Exo
31c94ec184
Add a lock for resolving events
2018-06-15 10:11:43 +02:00
Dan Elkouby
df15ee421c
Except connection timeouts in MTProtoSender
2018-06-15 10:58:29 +03:00
Lonami Exo
24d2074e0c
Set _input_chat on custom.Message creation/fixup input_chat
2018-06-14 23:40:44 +02:00
Lonami Exo
091b03c635
Use create_task instead ensure_future
2018-06-14 23:33:56 +02:00
Lonami Exo
f95400ea7e
Try again to get input_chat on EventsCommon
2018-06-14 23:26:04 +02:00
Lonami Exo
06cdf1fdb0
Raise on phone/network migrate if authorized
2018-06-14 23:16:00 +02:00
Lonami Exo
c788e17c22
Fix _handle_update not expanding Updates
2018-06-14 22:51:57 +02:00
Lonami Exo
179af9894f
Add missing parenthesis around await
2018-06-14 22:25:03 +02:00
Lonami Exo
0f14f3b16a
Support custom event loops
2018-06-14 19:35:12 +02:00
Lonami Exo
908dfa148b
Revisit codebase to add missing async/await
2018-06-14 17:09:20 +02:00
Lonami Exo
1247d050ab
Remove unused fields from the Sessions
...
Most of the stuff didn't actually need to be saved and only
belong to the MTProtoState which is not a separate class from
the sessions.
2018-06-14 17:04:15 +02:00
Lonami
bb3a564500
Merge pull request #843 from LonamiWebs/core-rewrite
...
Core rewrite
2018-06-14 16:25:28 +02:00
Lonami Exo
5bb2f50232
Handle Msg state/resend/all (from 7c0af2c
by @andr-04)
2018-06-14 16:23:16 +02:00
Lonami Exo
4a9eb5b085
Handle OSError on MTProtoSender
2018-06-14 16:16:11 +02:00
Lonami Exo
df1dfdf8ea
Remove some redundant except
2018-06-14 16:13:46 +02:00
Lonami Exo
c9ea1bafc0
Apply @andr-04 asyncio commits to TcpClient
2018-06-14 16:08:23 +02:00
Lonami Exo
3ce8b17193
Dispatch updates to event handlers
2018-06-13 16:20:15 +02:00
Lonami Exo
898ce34c65
Set __all__ on telethon.__init__.py
2018-06-13 11:50:36 +02:00
Lonami Exo
a91109c9fa
Retry send_code_request on AuthRestartError
2018-06-13 10:55:37 +02:00
Lonami Exo
8a787e90c2
Remove send/recv locks
...
There is only one method sending and one method receiving,
so it doesn't make sense to lock-protect those operations.
2018-06-13 10:04:27 +02:00
Lonami Exo
3324090c96
Fix non-asyncio sleep
2018-06-13 09:59:30 +02:00
Lonami Exo
3f16c92eb3
Subclass TLRequest for content-related objects
2018-06-12 20:14:21 +02:00
Lonami Exo
d1afc70963
Fix setting Pong results
2018-06-12 19:46:37 +02:00
Lonami Exo
d4dc147459
Handle DraftMessageEmpty ( closes #844 )
2018-06-12 19:25:13 +02:00
Lonami Exo
2a90de2b08
Fix broadcast being named post for is_group property
2018-06-12 12:31:37 +02:00
Lonami Exo
f9cd220ddd
Implement _get_exported_sender
2018-06-11 20:05:10 +02:00
Lonami Exo
64dd957189
Fix None first_query and TcpClient.disconnect()
2018-06-11 19:51:01 +02:00
Lonami Exo
f581db294a
Better custom.MessageButton.click() docs
2018-06-11 10:25:57 +02:00
Lonami Exo
aa6d3430ae
Properly handle bot timeouts when clicking buttons
2018-06-11 10:20:22 +02:00
Lonami Exo
f86f52d960
Fix async_generator's and missing awaits
2018-06-10 22:00:55 +02:00
Lonami Exo
8be6adeab4
Make use of the async_generator module
2018-06-10 21:50:28 +02:00
Lonami Exo
15ef302428
Implement _switch_dc/fix missing first request
2018-06-10 21:30:31 +02:00
Lonami Exo
4a491e45ce
Fix broken debug call
2018-06-10 21:02:22 +02:00
Lonami Exo
d462b04a9c
Add async/await on tl.custom
2018-06-10 20:29:57 +02:00
Lonami Exo
1bde72d375
Make the TelegramClient aggregate all client methods
2018-06-10 19:05:36 +02:00
Lonami Exo
fb8b052754
Separate update requests from the TelegramClient
2018-06-10 13:58:21 +02:00
Lonami Exo
ac2e59b472
Separate auth requests from the TelegramClient
2018-06-10 12:57:36 +02:00
Lonami Exo
4ff0756ffc
Separate download requests from the TelegramClient
2018-06-10 12:04:23 +02:00
Lonami Exo
317b7053a0
Separate parse message methods from uploads
2018-06-10 11:33:20 +02:00
Lonami Exo
83a024656c
Rename client.files as client.uploads
2018-06-09 22:14:51 +02:00
Lonami Exo
ad29f2f5b7
Separate chat requests from the TelegramClient
2018-06-09 22:13:18 +02:00
Lonami Exo
1e91e5a83c
Separate dialogs methods from the TelegramClient
2018-06-09 22:09:02 +02:00
Lonami Exo
4bd20f1ce2
Separate file and message methods from TelegramClient
2018-06-09 22:05:06 +02:00
Lonami Exo
bb9b9796e0
Separate user methods from the base client
2018-06-09 21:22:54 +02:00
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