Commit Graph

2052 Commits

Author SHA1 Message Date
Lonami Exo
233daafd96 Fix global search would fail if last message had no peer 2020-10-01 13:18:54 +02:00
Lonami Exo
668dcd52ca Update global search to properly use offset_rate 2020-10-01 12:23:34 +02:00
Tulir Asokan
8ce7e776c1 Add option to raise last error instead of generic ValueError (#1571) 2020-10-01 12:23:10 +02:00
Lonami Exo
d5e4398ace Adapt the rest of the library to layer 119 2020-10-01 12:22:55 +02:00
Lonami Exo
62737c1caf Partially upgrade to layer 119 2020-10-01 09:17:18 +02:00
Lonami Exo
10b2b60415 Fix requests were not re-enqueued if sending failed 2020-09-29 21:07:38 +02:00
Lonami Exo
c864ef7e16 Refetch msg if fileref expires while downloading docs
Closes #1301.
2020-09-24 10:03:28 +02:00
Lonami Exo
75fbd28d3e Add a workaround for sometimes-missing photos from channels 2020-09-22 11:08:17 +02:00
Lonami Exo
219b4ecb77 Abstract away treating a file as a stream
Makes upload_file cleaner (context manager instead of try-finally)
and helps keep the logic "we may own this stream and need to close
it or not" separated.

It can be overengineered to allow nesting the same instance in
context managers and also provide implementations for synchronous
context managers but it adds quite a bit of unnecessary complexity
for the time being. YAGNI.
2020-09-14 16:20:44 +02:00
yash-dk
1d6fd7898a
Consider all reconnect attempts as retrying (#1557)
This means that a value of 0 retries will no longer try to reconnect.
2020-09-13 09:43:01 +02:00
apepenkov
2a114917f1
Fix AlbumHack in combination with events.Raw (#1555) 2020-09-10 16:25:44 +02:00
Tanya Degurechaff
1afb5b95e3
Update init params to match those of tdesktop (#1549) 2020-09-10 14:52:25 +02:00
Allerter
1ed0f75c49
Support extracting metadata from bytes and stream objects (#1547)
This should enable more accurate uploads of in-memory files.
2020-09-08 00:20:37 +02:00
Lonami Exo
0c9d0db730 Update to v1.16.4
v1.16.3 was accidentally released without the intended bug-fixes.
2020-08-24 12:54:56 +02:00
penn5
1a9accbe5d
Fix warning when using formatted phones in start (#1532) 2020-08-24 10:53:29 +02:00
Lonami Exo
73109eb819 Add a workaround for channels that claim have no photos but do 2020-08-13 15:13:29 +02:00
Lonami Exo
e00496aa63 Update to v1.16.2 2020-08-11 23:16:09 +02:00
Lonami Exo
e19aa44d5c Sort thumbs to ensure -1 is largest
Closes #1519.
2020-08-11 23:14:31 +02:00
Lonami Exo
0cefc73448 Support both str and VideoSize as thumb on download_media 2020-08-11 22:31:12 +02:00
Lonami Exo
3c56a6db4d Update to v1.16.1 2020-08-10 16:19:31 +02:00
Lonami Exo
9a0d6b9931 Don't set force_file on force_document with images
Otherwise, Telegram won't analyze the image and won't add it the
DocumentAttributeImageSize, causing some bots like t.me/Stickers
to break.

Closes #1507.
2020-08-10 16:09:39 +02:00
Lonami Exo
ddeefff431 Add a warning when trying to connect to a different account
Closes #1172, and also fixed a typo.
2020-08-08 17:49:00 +02:00
conetra
958698bba7
Remove square bracket around IPv6 addresses (#1517) 2020-08-08 13:16:01 +02:00
Lonami Exo
1d71cdc9e0 Support autocast of polls into input media when possible
Closes #1516.
2020-08-07 16:03:50 +02:00
Lonami Exo
241c6c4ac8 Auto-retry on interdc call (rich) error 2020-08-03 12:35:25 +02:00
Lonami Exo
34861ad1bc Update to v1.16 2020-07-28 18:12:24 +02:00
Lonami Exo
f18ab08334 Add new friendly method to get channel stats 2020-07-26 13:45:30 +02:00
Lonami Exo
e12f6c747f Extend use of force_document to work on files
This allows .webp files to be sent as documents and not stickers.
2020-07-26 13:03:59 +02:00
Lonami Exo
95ea2fb40c Remove uses of gif external
Since it has been removed in layer 116.
2020-07-26 12:59:10 +02:00
Lonami Exo
1c3e7dda01 Avoid explicitly passing the loop to asyncio
This behaviour is deprecated and will be removed in future versions
of Python. Technically, it could be considered a bug (invalid usage
causing different behaviour from the expected one), and in practice
it should not break much code (because .get_event_loop() would likely
be the same event loop anyway).
2020-07-25 18:39:35 +02:00
Lonami Exo
de17a19168 Improve upload_file by properly supporting streaming files 2020-07-15 14:35:42 +02:00
Shrimadhav U K
bfb8de2736
Update upload file size limit to 2GB (#1499)
Source: https://t.me/tginfo/2656
Closes #1498.
2020-07-06 20:11:40 +02:00
Lonami Exo
e44926114a Bump to v1.15 2020-07-04 13:29:43 +02:00
Lonami Exo
326f70b678 Support clicking on buttons asking for phone/location
Closes #1492.
2020-07-04 13:29:43 +02:00
Lonami Exo
7b852206f1 Fix click timeout error is now different 2020-07-04 13:29:43 +02:00
Lonami Exo
ab594ed0cb Remove unused imports and variables 2020-07-04 13:29:43 +02:00
KnorpelSenf
0f8119c400
Fix typo in docs (#1493) 2020-06-24 14:30:41 +02:00
Tulir Asokan
ba4f4c1f78
Fix url property in QRLogin (#1494) 2020-06-24 14:11:54 +02:00
Lonami Exo
e0c3143763 Update documentation with new errors and further clarifications 2020-06-22 13:21:45 +02:00
Lonami Exo
3e511484c7 Support pathlib.Path on download_file
Fixes #1379.
2020-06-06 21:07:22 +02:00
Lonami Exo
4b933069f1 Add hacks to properly handle events.Album from other DCs
Fixes #1479.
2020-06-06 21:01:02 +02:00
Lonami Exo
faf7263d8f Handle RPC errors on auto-get_difference
Closes #1428.
2020-06-06 14:04:14 +02:00
Lonami Exo
db3e7656e0 Handle AssertionError when cancelling tasks
Fixes #1478.
2020-06-06 13:54:19 +02:00
Lonami Exo
3f74f83964 Move qrlogin with the rest of custom types 2020-06-06 13:47:56 +02:00
penn5
8557effe13
Fix docs in InlineQuery (#1425) 2020-06-06 13:47:46 +02:00
Lonami Exo
c904b7ccd8 Add a friendly method for QR login
Closes #1471.
2020-06-05 21:58:59 +02:00
Lonami Exo
bfa995d52b Don't crash when receiving updates prior to login
Fixes #1467, and enables #1471.
2020-06-05 21:17:09 +02:00
Lonami Exo
8330635a72 Bump to v1.14.0 2020-05-26 09:31:36 +02:00
Lonami Exo
a46ce053f1 Fix another crash for return value when sending albums 2020-05-24 19:01:05 +02:00
Lonami Exo
88e7f0da65 Fix return value when fwding msgs if some are missing
It was supposed to return None for the spots were it failed to fwd
a message, but instead only those that were present were returned,
because we were iterating over the wrong object (dict and not list).
2020-05-24 18:41:30 +02:00
Lonami Exo
29eb90e503 Fix get_pinned_message in Chat
Closes #1458.
2020-05-17 09:35:44 +02:00
JuniorJPDJ
634bc3a8bd
Allow event's func to be async (#1461)
Fixes #1344.
2020-05-16 09:58:37 +02:00
penn5
c45f2e7c39
Handle flood waits of 0 seconds more gracefully (#1460) 2020-05-13 18:50:56 +02:00
Lonami Exo
393da7e57a Expose missing embed_links param in edit_permissions 2020-05-09 17:35:26 +02:00
Lonami Exo
4393ec0b83 Support dice autocast and update docs on send_file for dice 2020-05-05 09:28:37 +02:00
Lonami Exo
c43e2a0a3a Return produced service message with pin_message
Fixes #1394.
2020-04-29 10:29:14 +02:00
Lonami Exo
74bced75b4 Check if the conversation was cancelled on send methods
Fixes #1411.
2020-04-28 21:02:27 +02:00
Lonami Exo
7ea4686d6c Handle FloodWaitError in client.download_media
Fixes #1426. Not entirely happy with the new indirection layer,
but the original __call__ method is already a mess anyway and
the additional cost of an extra call should be neglible compared
to the actual IO.
2020-04-28 20:49:57 +02:00
Lonami Exo
7f3aa43ad4 Rely on types.UpdateChatPinnedMessage for chat unpins
Fixes #1405, probably.
2020-04-27 21:16:45 +02:00
Lonami Exo
71ed1564cb Add a new .dice property to Message 2020-04-27 20:43:09 +02:00
Lonami Exo
bfa46f47ed Register application/x-tgsticker to mimetypes 2020-04-26 13:42:16 +02:00
Lonami Exo
eb58e60dd1 Fix string formatting on events.Raw with bad input param 2020-04-26 13:42:16 +02:00
TishSerg
a16c60c886
Fix action 'song' should alias 'audio' (#1444) 2020-04-26 11:00:00 +02:00
Lonami Exo
c487340f8e Bump to v1.13.0 2020-04-25 16:28:13 +02:00
Lonami Exo
c37dc69592 Fix downloading thumb was using name inferred for video 2020-04-23 21:01:29 +02:00
Lonami Exo
0c8a90f2a3 Fix delete_messages(None, ...) not working 2020-04-23 20:40:23 +02:00
Lonami Exo
67a9718f9e Bump to v1.12.0 2020-04-20 15:12:00 +02:00
Lonami Exo
01cf4967a5 Clarify send_read_acknowledge behaviour and add new error 2020-04-13 15:03:13 +02:00
ov7a
79fb1a54cb
Switch to blocking connect when using proxy (#1432)
Until a better fix is found, this should help proxy users.
2020-04-12 14:28:40 +02:00
Lonami Exo
d0f937bcb6 Don't disconnect borrowed senders immediately (#1364) 2020-04-05 12:34:33 +02:00
Arne Beer
3729fde572
Fix editing of inline messages in some cases (#1427) 2020-04-03 18:37:46 +02:00
Dmitry D. Chernov
0ec612d71a utils: Style fix and simplify a bit the VALID_USERNAME_RE 2020-03-31 19:18:57 +10:00
YouTwitFace
1669d80082
Remove call to _cache_media (#1419)
Fixes #1418
2020-03-29 10:15:53 +02:00
Lonami Exo
3ab9986fc7 Slightly better flow in _file_to_media 2020-03-14 12:16:52 +01:00
Lonami Exo
ccfd7a1015 Don't ignore thumb in send_file(input file)
Fixes #1404
2020-03-14 12:12:40 +01:00
Lonami Exo
68438f4621 Don't store refs to files in cache
File cache has been unused since file_reference were introduced,
there's no point saving them to cache if they're never queried.

Fixes #1400.
2020-03-11 10:07:21 +01:00
Lonami Exo
e3d8109110 Fix a doc typo and update projects using the lib 2020-03-11 10:02:19 +01:00
painor
0e0052888f
Expose key and iv parameter in downloads/uploads (#1397) 2020-03-04 16:12:34 +01:00
Lonami Exo
1ec38aa5b2 Update and clarify some docs
cc #1388, #1396
2020-02-28 11:50:16 +01:00
Lonami Exo
e451abbf20 Avoid another MemoryError 2020-02-28 10:42:23 +01:00
Lonami Exo
e9c5e719f1 Minor docs update, bump v1.11.3 2020-02-24 13:15:56 +01:00
Lonami Exo
9a86447b6e Fix get(_input)_users in ChatAction with no service msg 2020-02-24 13:07:13 +01:00
Pascal Jürgens
0814a20ec4
Fix macOS version parsing (again), bump v1.11.2
#1393
2020-02-21 20:37:24 +01:00
Lonami Exo
8aa15174ab Fix check in macOS (#1369), bump v1.11.1 2020-02-21 12:48:43 +01:00
Lonami Exo
f21abcd529 Update to v1.11 2020-02-20 20:57:17 +01:00
Lonami Exo
1e94fe25fa Log requests that trigger struct.error
The exception hardly provides any valuable information.
This will hopefully help troubleshooting why the error happens.
2020-02-20 13:40:08 +01:00
Lonami Exo
7ffb87170b Update some URLs
Some were out of date, some were examples pointing to a personal
link, which were replaced with generic examples.
2020-02-20 11:50:15 +01:00
Lonami Exo
3d32e16235 Fix within surrogate detection 2020-02-20 10:53:28 +01:00
Lonami Exo
3a6c955c90 Add examples to all events 2020-02-20 10:18:26 +01:00
Lonami Exo
9f73c35621 Fix unparsing of entities that are together 2020-02-20 09:43:37 +01:00
Tulir Asokan
95dc775344
Fix errors found by new tests (#1389) 2020-02-14 18:35:42 +01:00
Lonami
ac8009af4a
Fix default DC ID value 2020-02-02 10:01:15 +01:00
Lonami Exo
5f8032584b Fix _get_response_message for sendMedia(live location) 2020-02-01 15:32:52 +01:00
Lonami Exo
22e645e22f Update to layer 109 2020-01-23 13:43:20 +01:00
Lonami Exo
acb8518911 Fix send_message not forwarding some args to send_file 2020-01-22 14:21:09 +01:00
Lonami Exo
a2fc7dca79 Handle users=None properly in ChatAction 2020-01-21 10:39:51 +01:00
Lonami Exo
da9505fa3c Add some missing words in the docs 2020-01-19 13:25:58 +01:00
Pascal Jürgens
72dc8052b3 Fix crypto imports on macOS Catalina (#1369) 2020-01-17 12:24:59 +01:00
Alexhol
76cc076d61 Fix send_file not considering videos for albums (#1371) 2020-01-17 11:12:20 +01:00
Lonami Exo
78ee787310 Fix utils._get_extension not working in pathlib objects
This was found while testing #1371.
2020-01-17 11:11:10 +01:00