Lonami Exo
c1be0bd2e8
Fix disconnection without a previous connection
2019-05-11 16:53:11 +02:00
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