Lonami Exo
522681f463
Handle UserEmpty in utils.get_peer
...
Closes #1552 .
2020-10-01 14:02:54 +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
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
1d71cdc9e0
Support autocast of polls into input media when possible
...
Closes #1516 .
2020-08-07 16:03:50 +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
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
4393ec0b83
Support dice autocast and update docs on send_file for dice
2020-05-05 09:28:37 +02:00
Lonami Exo
bfa46f47ed
Register application/x-tgsticker to mimetypes
2020-04-26 13:42:16 +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
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
78ee787310
Fix utils._get_extension not working in pathlib objects
...
This was found while testing #1371 .
2020-01-17 11:11:10 +01:00
Lonami Exo
582a61192a
Fix MemoryError on get_input_media(game)
...
Because an integer was being passed where a TLObject was expected,
so the serialization with bytes() was actually requesting that many
bytes as opposed to properly converting the expected object.
2020-01-04 17:52:31 +01:00
Lonami Exo
a142b7de5e
Handle invalid upload of text fd more gracefully
2019-12-27 12:05:27 +01:00
Lonami Exo
627e176f8e
Handle *FromMessage peers in utils' casts
2019-12-23 13:47:55 +01:00
Lonami Exo
a67c94787b
Make getting PhotoSize byte count more reusable internally
2019-10-31 19:38:27 +01:00
YouTwitFace
4a8b19b0be
Remove @ya from valid usernames ( #1306 )
2019-10-28 18:12:47 +01:00
Lonami
6da8d1a0ec
Less confusing error for getting marked ID of PeerChannel(0)
...
Fixes #1282 .
2019-09-24 19:01:46 +02:00
Lonami
75ca28df49
Parse t.me/@<user> URLs as valid usernames
2019-09-16 11:36:35 +02:00
Lonami Exo
c1774276c2
Fix handling of ChannelForbidden in input peer, bump v1.10.3
2019-09-12 22:30:47 +02:00
Lonami Exo
9c06f29aaf
Don't cache entities with min flag set, bump v1.10.2
...
Since layer 102, there are two access_hash. One with the min flag,
and one without it. This was causing channel invalid errors.
access_hash with min flag set can only be used to fetch files such
as profile pictures.
access_hash with min flag unset can be used under all circumstances.
Previously, the library did not distinguish between these, so it was
caching the hash that could hardly be used for anything.
With this change, only the "full" access_hash is stored, which will
work for any methods.
See also: https://core.telegram.org/api/min
2019-09-12 19:19:46 +02:00
Lonami Exo
e1905d0d7a
Avoid using telethon.sync in the examples
2019-08-13 23:33:39 +02:00
Lonami Exo
b1eed82b7f
Fix use of newer file IDs and add two new errors
2019-08-06 23:25:58 +02:00
Lonami Exo
eb44c6634b
Add Dialog to auto cast to peer
2019-07-23 12:44:06 +02:00
Lonami Exo
8e36bb4c4d
Link Python keywords with Python's documentation
2019-07-06 12:11:00 +02:00
Lonami Exo
35ba9848d9
Fix get_extension missing even more photo cases
2019-06-16 11:15:52 +02:00
Lonami Exo
fd37e44854
Fix is_image not considering MessageMedia objects
...
This was causing albums with MessageMedia objects to fail.
2019-06-15 16:42:26 +02:00
Lonami Exo
770c2c504d
Add new methods to encode and decode waveforms
2019-06-04 21:36:38 +02:00
Hasan
4b74d16438
Fix file_id error checking ( #1189 )
2019-05-19 22:18:35 +02:00
Lonami Exo
fefd6f0e6d
Fix use of tg://join?invite= channels
2019-05-12 13:44:09 +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
c6691dc6a8
Update the reference with even more types and other docs
2019-05-07 21:25:55 +02:00
Lonami Exo
19398d75be
Add support for hexadecimal invite links
2019-05-05 11:56:04 +02:00
Lonami Exo
1e17ef1c98
Apply several lints
2019-05-03 21:38:41 +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
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
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
21aec00e46
Fix downloading photos with download_file ( #1164 )
2019-04-24 12:37:19 +02:00
Lonami Exo
bb23bc0fd2
Finish update to layer 98
2019-04-22 19:05:25 +02:00
Lonami Exo
8868ce14e8
Update to layer 98
2019-04-22 16:51:05 +02: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
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
Wirtos
c4d65f8bf4
ValueError fix for IOBase files ( #1119 )
2019-03-01 21:27:15 +01:00
Lonami Exo
8e36c0002b
Fix sending albums with bot file IDs
2019-02-25 18:23:39 +01: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
5772a5483c
Check dc_id in resolve_bot_file_id
2019-02-13 09:16:34 +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
de84bf08bf
Support MessageMedia in pack_bot_file_id
2019-02-10 12:30:20 +01:00