Commit Graph

189 Commits

Author SHA1 Message Date
Lonami Exo
bd11564579 Remove uses of imghdr
It's deprecated. Closes #4207.
2023-09-20 18:30:57 +02:00
Lonami Exo
2826c942c0 Support most usernames in VALID_USERNAME_RE
See #4128.
2023-06-09 17:41:45 +02:00
Lonami Exo
cb04e269c0 Fix _get_entity_pair could receive None as input 2023-04-06 13:39:56 +02:00
Lonami Exo
f7e38ee6f0 Remove redundant entity cache
Progress towards #3989.
May also help with #3235.
2023-04-06 13:25:48 +02:00
Lonami Exo
06536cfb91 Recognize invite links with plus sign prefix 2022-09-20 10:57:52 +02:00
Devesh Pal
362d06654f
Support sending 4GB files (#3891) 2022-07-28 12:30:46 +02:00
Lonami Exo
c9ecd61f7e Fix peer ID check to work with higher IDs
This commit is taken from
5f4bfe6b9b
2021-12-01 19:03:59 +01:00
Lonami Exo
2e1be01ad4 Add ttl parameter to send_file 2021-09-11 11:02:19 +02:00
Anonymous
7c5efee1de
Update to layer 129 and other additions/enhancements (#3074)
* Apply code corrections for the new layer types.
* Support not passing `user` to `get_permissions`.
* `download_profile_photo` now supports `MessageService`.
* `thumb` in send and edit message.
* Document new known errors.
2021-06-15 22:57:32 +02:00
Lonami Exo
4b16183d2b Audio metadata may have performer under artist
Closes  #3008.
2021-03-31 10:57:20 +02:00
Lonami Exo
b102f1f345 Handle progressive size in _photo_size_byte_count 2021-02-13 22:49:03 +01:00
Lonami Exo
6f7640af18 Fix utils.resolve_id
…assuming get_peer_id is correct, as changed by 0d8497b.
2021-01-28 20:01:46 +01:00
Lonami Exo
9a6bc5ae72 Update defaults and docs for video attributes
Closes #1679.
2021-01-26 21:10:21 +01:00
Shrimadhav U K
3ddb0a3903
Fix thumbnail for TDesktop and Telegram X users (#1673) 2021-01-17 17:31:26 +01:00
Lonami
4bf1d67eba
Fix resolve_invite_link in Python 3.6 2021-01-12 20:04:34 +01:00
painor
c0ed709adf
Add new format to resolve invite link (#1670) 2021-01-12 19:50:27 +01:00
Lonami Exo
0a4d54fca4 Update to layer 122
Closes #1645.
2020-12-11 16:55:49 +01:00
Lonami Exo
c924365e24 Handle ChatEmpty in utils.get_peer 2020-11-13 10:59:53 +01:00
Lonami Exo
e1d2c81dca Parse part of newer bot file IDs for photos
Helps with #1613.
2020-11-07 12:46:46 +01:00
Lonami Exo
0d8497bf3b Correct and simplify the way channel IDs are marked
Closes #1359.
2020-11-07 12:18:55 +01:00
hematogender
b6fe4b8fec
Fix get_display_name not handling ChatForbidden (#1617)
Closes #1616.
2020-11-04 20:28:04 +01:00
Lonami Exo
e5476e6fef Add utils.split_text to split very large messages 2020-10-23 10:57:45 +02:00
Qwerty-Space
d56b27e570
Fix several minor typos (#1603) 2020-10-18 21:11:59 +02:00
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