Commit Graph

111 Commits

Author SHA1 Message Date
yzx23333 1db71f6d7d Add customizable 'mime_type' for send_file 2025-05-25 17:32:41 +02:00
Shrimadhav U K 859f7423f2 Add send_as and effect parameters in high level 2025-03-08 17:21:49 +01:00
s1xu 9762a83541 fix: support batch sending of image URLs and video URLs in albums 2025-02-08 15:40:56 +01:00
Nick80835 b9aafa3441 Fix IOError with some image modes in photo resize
This fixes image compression with mode "P" (potentially others) which is necessary as the server has erroneous alpha color with some types of images (mode "P" for example). This also properly applies the background argument that may be passed to _resize_photo_if_needed by always compressing images with alpha regardless of whether the server will compress the image for us.
2025-01-13 20:37:36 +01:00
Lonami Exo 9ca3b599fc Fix Python 3.6 compatibility
Introduced on accident by #4475.
2024-11-18 17:04:07 +01:00
Arkadii Halchenko 3f589b287d Fix parse_mode with albums (#4494)
Closes #4492.
2024-10-20 19:50:08 +02:00
Arkadii Halchenko 4553f04e49 Fix formatting_entities not working for albums (#4475) 2024-10-05 11:13:20 +02:00
Lonami Exo ddc9bef503 Force filename with JPG extension after resizing
Old name does not matter, since we just encoded it as JPEG
2023-11-12 21:13:24 +01:00
Lonami Exo fda6840449 Fix file name could be lost when uploading files
Leading to invalid extension when sending photos.
2023-10-17 20:31:58 +02:00
Lonami Exo 211238fcd2 Fix reply_to when sending albums 2023-07-24 17:25:03 +02:00
Nick80835 694c78c8e9 Improve image compression heuristics and algorithm used (#4158) 2023-07-23 21:58:10 +02:00
Lonami Exo 164d35681e Fix reply_to can be optional 2023-07-21 22:44:35 +02:00
Lonami Exo 75ed58ad89 Update to layer 160 2023-07-21 21:24:10 +02:00
Deer-Spangle 6e7423e894 Allowing nosound_video to be specified (#4090) 2023-04-14 22:03:03 +02:00
Nick80835 7b1b33f805 Save photos as progressive when uploading (#4089) 2023-04-13 20:11:52 +02:00
Lonami Exo 0f7756ac68 Remove dead code from send_file 2023-03-28 18:17:07 +02:00
Lonami Exo 33c5ee9be4 Implement progress_callback for sending albums
Closes #3190.
2023-03-28 18:15:57 +02:00
Nick80835 1f8b59043b Change maximum photo size to 2560px (#4024) 2023-01-18 17:37:56 +01:00
th3c00lw0lf ef4f9a962c Fix MediaEmptyError error when sending some videos (#3951) 2022-10-15 20:01:29 +02:00
Lonami Exo 2d4305db76 Wrap buttons typehint in Optional
Closes #3762.
2022-09-20 18:03:16 +02:00
Lonami Exo 2e1be01ad4 Add ttl parameter to send_file 2021-09-11 11:02:19 +02:00
Devesh Pal e5599c178b Expose more raw API params in friendly methods (#3104) 2021-08-05 10:54:07 +02:00
Non a376faa3a8 Fix MD5_CHECKSUM_INVALID for small files with custom key/iv (#3024)
Closes #3023.
2021-04-10 21:46:14 +02:00
Lonami Exo 8c38d7fb0e Add missing parenthesis 2021-01-30 10:32:42 +01:00
Lonami Exo ea57db7aad Add comment_to parameter to more easily post comments 2021-01-28 21:05:20 +01:00
Lonami Exo 320ab75818 Respect exif metadata when resizing photos
Closes #1663.
2021-01-26 21:44:11 +01:00
Lonami Exo 9a6bc5ae72 Update defaults and docs for video attributes
Closes #1679.
2021-01-26 21:10:21 +01:00
Googleplex a886d609d9 Support sending album with URL photos (#1681)
Fixes #1408.
2021-01-25 08:31:25 +01:00
Shrimadhav U K 3ddb0a3903 Fix thumbnail for TDesktop and Telegram X users (#1673) 2021-01-17 17:31:26 +01:00
Richard ba3a090a80 Update send_file to support grouping any file type (#1620) 2020-11-07 17:32:00 +01:00
Tulir Asokan bf29cddbc9 Add parameter to pass raw entities when sending message (#1577) 2020-10-02 22:06:48 +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
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 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 de17a19168 Improve upload_file by properly supporting streaming files 2020-07-15 14:35:42 +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 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
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 acb8518911 Fix send_message not forwarding some args to send_file 2020-01-22 14:21:09 +01:00
Alexhol 76cc076d61 Fix send_file not considering videos for albums (#1371) 2020-01-17 11:12:20 +01:00
Lonami Exo a142b7de5e Handle invalid upload of text fd more gracefully 2019-12-27 12:05:27 +01:00
Lonami Exo bdb74ac235 Support async fd on download/upload (#1334) 2019-12-27 12:04:08 +01:00
Lonami Exo 6817e19923 Fix return value of send_file(album) of the same media 2019-11-10 14:59:01 +01:00
Lonami Exo 5e6ff67d01 Make allow_cache do nothing for now, bump v1.10.5 (#1272) 2019-09-27 15:12:17 +02:00
Lonami Exo dab237e758 Support sending scheduled messages 2019-09-06 13:45:31 +02:00
painor 61bc8f7fa3 Fix-up #1259 missing import (#1261) 2019-08-25 21:29:17 +02:00