From a6ae13c72b951e72b7d9fa436315097cdf9f6674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=8B=D1=80=D1=86=D0=B5=D0=B2=20=D0=92=D0=B0=D0=B4?= =?UTF-8?q?=D0=B8=D0=BC=20=D0=98=D0=B3=D0=BE=D1=80=D0=B5=D0=B2=D0=B8=D1=87?= Date: Thu, 4 Apr 2024 20:23:28 +0300 Subject: [PATCH] Rename "thumb" to "thumbnail" in methods --- crates/teloxide-core/schema.ron | 10 +++++----- crates/teloxide-core/src/payloads/send_animation.rs | 4 ++-- crates/teloxide-core/src/payloads/send_audio.rs | 4 ++-- crates/teloxide-core/src/payloads/send_document.rs | 4 ++-- crates/teloxide-core/src/payloads/send_video.rs | 4 ++-- crates/teloxide-core/src/payloads/send_video_note.rs | 4 ++-- crates/teloxide-core/src/serde_multipart/mod.rs | 4 +++- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/crates/teloxide-core/schema.ron b/crates/teloxide-core/schema.ron index 1c541f4a..1991fd1c 100644 --- a/crates/teloxide-core/schema.ron +++ b/crates/teloxide-core/schema.ron @@ -574,7 +574,7 @@ Schema( descr: Doc(md: "Track name"), ), Param( - name: "thumb", + name: "thumbnail", ty: Option(RawTy("InputFile")), descr: Doc( md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »]", @@ -646,7 +646,7 @@ Schema( ), ), Param( - name: "thumb", + name: "thumbnail", ty: Option(RawTy("InputFile")), descr: Doc( md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »]", @@ -759,7 +759,7 @@ Schema( descr: Doc(md: "Video height"), ), Param( - name: "thumb", + name: "thumbnail", ty: Option(RawTy("InputFile")), descr: Doc( md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »]", @@ -875,7 +875,7 @@ Schema( descr: Doc(md: "Animation height"), ), Param( - name: "thumb", + name: "thumbnail", ty: Option(RawTy("InputFile")), descr: Doc( md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »]", @@ -1069,7 +1069,7 @@ Schema( descr: Doc(md: "Video width and height, i.e. diameter of the video message"), ), Param( - name: "thumb", + name: "thumbnail", ty: Option(RawTy("InputFile")), descr: Doc( md: "Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »]", diff --git a/crates/teloxide-core/src/payloads/send_animation.rs b/crates/teloxide-core/src/payloads/send_animation.rs index a1ee3129..500a66a5 100644 --- a/crates/teloxide-core/src/payloads/send_animation.rs +++ b/crates/teloxide-core/src/payloads/send_animation.rs @@ -7,7 +7,7 @@ use crate::types::{ }; impl_payload! { - @[multipart = animation, thumb] + @[multipart = animation, thumbnail] /// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent [`Message`] is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. /// /// [`Message`]: crate::types::Message @@ -33,7 +33,7 @@ impl_payload! { /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »] /// /// [More info on Sending Files »]: crate::types::InputFile - pub thumb: InputFile, + pub thumbnail: InputFile, /// Animation caption (may also be used when resending videos by _file\_id_), 0-1024 characters after entities parsing pub caption: String [into], /// Mode for parsing entities in the animation caption. See [formatting options] for more details. diff --git a/crates/teloxide-core/src/payloads/send_audio.rs b/crates/teloxide-core/src/payloads/send_audio.rs index 2fbfe5f5..fcb12f4d 100644 --- a/crates/teloxide-core/src/payloads/send_audio.rs +++ b/crates/teloxide-core/src/payloads/send_audio.rs @@ -7,7 +7,7 @@ use crate::types::{ }; impl_payload! { - @[multipart = audio, thumb] + @[multipart = audio, thumbnail] /// Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent [`Message`] is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. /// /// For sending voice messages, use the [`SendVoice`] method instead. @@ -44,7 +44,7 @@ impl_payload! { /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »] /// /// [More info on Sending Files »]: crate::types::InputFile - pub thumb: InputFile, + pub thumbnail: InputFile, /// Sends the message [silently]. Users will receive a notification with no sound. /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages diff --git a/crates/teloxide-core/src/payloads/send_document.rs b/crates/teloxide-core/src/payloads/send_document.rs index eda12a07..cfe41cc4 100644 --- a/crates/teloxide-core/src/payloads/send_document.rs +++ b/crates/teloxide-core/src/payloads/send_document.rs @@ -7,7 +7,7 @@ use crate::types::{ }; impl_payload! { - @[multipart = document, thumb] + @[multipart = document, thumbnail] /// Use this method to send general files. On success, the sent [`Message`] is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. /// /// [`Message`]: crate::types::Message @@ -27,7 +27,7 @@ impl_payload! { /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »] /// /// [More info on Sending Files »]: crate::types::InputFile - pub thumb: InputFile, + pub thumbnail: InputFile, /// Document caption (may also be used when resending documents by _file\_id_), 0-1024 characters after entities parsing pub caption: String [into], /// Mode for parsing entities in the audio caption. See [formatting options] for more details. diff --git a/crates/teloxide-core/src/payloads/send_video.rs b/crates/teloxide-core/src/payloads/send_video.rs index 2c141e8c..4ecfc6bf 100644 --- a/crates/teloxide-core/src/payloads/send_video.rs +++ b/crates/teloxide-core/src/payloads/send_video.rs @@ -7,7 +7,7 @@ use crate::types::{ }; impl_payload! { - @[multipart = video, thumb] + @[multipart = video, thumbnail] /// Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as [`Document`]). On success, the sent [`Message`] is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. /// /// [`Document`]: crate::types::Document @@ -34,7 +34,7 @@ impl_payload! { /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »] /// /// [More info on Sending Files »]: crate::types::InputFile - pub thumb: InputFile, + pub thumbnail: InputFile, /// Video caption (may also be used when resending videos by _file\_id_), 0-1024 characters after entities parsing pub caption: String [into], /// Mode for parsing entities in the video caption. See [formatting options] for more details. diff --git a/crates/teloxide-core/src/payloads/send_video_note.rs b/crates/teloxide-core/src/payloads/send_video_note.rs index 787e63cb..5b7afd9a 100644 --- a/crates/teloxide-core/src/payloads/send_video_note.rs +++ b/crates/teloxide-core/src/payloads/send_video_note.rs @@ -5,7 +5,7 @@ use serde::Serialize; use crate::types::{InputFile, Message, MessageId, Recipient, ReplyMarkup, ThreadId}; impl_payload! { - @[multipart = video_note, thumb] + @[multipart = video_note, thumbnail] /// As of [v.4.0], Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent [`Message`] is returned. /// /// [v.4.0]: https://core.telegram.org/bots/api#document @@ -30,7 +30,7 @@ impl_payload! { /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . [More info on Sending Files »] /// /// [More info on Sending Files »]: crate::types::InputFile - pub thumb: InputFile, + pub thumbnail: InputFile, /// Sends the message [silently]. Users will receive a notification with no sound. /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages diff --git a/crates/teloxide-core/src/serde_multipart/mod.rs b/crates/teloxide-core/src/serde_multipart/mod.rs index 7827823e..9d48a112 100644 --- a/crates/teloxide-core/src/serde_multipart/mod.rs +++ b/crates/teloxide-core/src/serde_multipart/mod.rs @@ -173,7 +173,9 @@ mod tests { InputFile::file("../../media/teloxide-core-logo.png"), ) .caption_entities(entities()) - .thumb(InputFile::read(File::open("../../media/teloxide-core-logo.png").await.unwrap())) + .thumbnail(InputFile::read( + File::open("../../media/teloxide-core-logo.png").await.unwrap(), + )) .allow_sending_without_reply(true), ) .unwrap()