diff --git a/README.md b/README.md index 186621c4..02d3faef 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ - + diff --git a/src/payloads/copy_message.rs b/src/payloads/copy_message.rs index b003fcf8..6eec57d5 100644 --- a/src/payloads/copy_message.rs +++ b/src/payloads/copy_message.rs @@ -37,6 +37,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/forward_message.rs b/src/payloads/forward_message.rs index 2ccad51e..9c34f0b7 100644 --- a/src/payloads/forward_message.rs +++ b/src/payloads/forward_message.rs @@ -29,6 +29,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, } } } diff --git a/src/payloads/send_animation.rs b/src/payloads/send_animation.rs index 6e05aa5b..e5c69e98 100644 --- a/src/payloads/send_animation.rs +++ b/src/payloads/send_animation.rs @@ -48,6 +48,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_audio.rs b/src/payloads/send_audio.rs index 2097ccd3..61dd6c01 100644 --- a/src/payloads/send_audio.rs +++ b/src/payloads/send_audio.rs @@ -51,6 +51,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_contact.rs b/src/payloads/send_contact.rs index 01852e8f..ab530447 100644 --- a/src/payloads/send_contact.rs +++ b/src/payloads/send_contact.rs @@ -35,6 +35,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_dice.rs b/src/payloads/send_dice.rs index fc19d585..426154ac 100644 --- a/src/payloads/send_dice.rs +++ b/src/payloads/send_dice.rs @@ -27,6 +27,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_document.rs b/src/payloads/send_document.rs index 3ca72ba4..71f5103a 100644 --- a/src/payloads/send_document.rs +++ b/src/payloads/send_document.rs @@ -44,6 +44,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_game.rs b/src/payloads/send_game.rs index eaa8e9e9..8d30f29c 100644 --- a/src/payloads/send_game.rs +++ b/src/payloads/send_game.rs @@ -27,6 +27,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_invoice.rs b/src/payloads/send_invoice.rs index 3ffe3b93..503ddfb6 100644 --- a/src/payloads/send_invoice.rs +++ b/src/payloads/send_invoice.rs @@ -72,6 +72,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_location.rs b/src/payloads/send_location.rs index 96c7e4c4..ba482dc2 100644 --- a/src/payloads/send_location.rs +++ b/src/payloads/send_location.rs @@ -39,6 +39,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_media_group.rs b/src/payloads/send_media_group.rs index 66d9f619..95fd7886 100644 --- a/src/payloads/send_media_group.rs +++ b/src/payloads/send_media_group.rs @@ -27,6 +27,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_message.rs b/src/payloads/send_message.rs index e3ff3dab..e27ddfc1 100644 --- a/src/payloads/send_message.rs +++ b/src/payloads/send_message.rs @@ -35,6 +35,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_photo.rs b/src/payloads/send_photo.rs index a5dffae2..d54e912d 100644 --- a/src/payloads/send_photo.rs +++ b/src/payloads/send_photo.rs @@ -38,6 +38,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_poll.rs b/src/payloads/send_poll.rs index 88ecf6a8..52d19938 100644 --- a/src/payloads/send_poll.rs +++ b/src/payloads/send_poll.rs @@ -53,6 +53,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_sticker.rs b/src/payloads/send_sticker.rs index 357e10c3..a66f4ba2 100644 --- a/src/payloads/send_sticker.rs +++ b/src/payloads/send_sticker.rs @@ -30,6 +30,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_venue.rs b/src/payloads/send_venue.rs index b3181b78..78a901a2 100644 --- a/src/payloads/send_venue.rs +++ b/src/payloads/send_venue.rs @@ -43,6 +43,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_video.rs b/src/payloads/send_video.rs index c815e255..0dae2154 100644 --- a/src/payloads/send_video.rs +++ b/src/payloads/send_video.rs @@ -51,6 +51,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/payloads/send_video_note.rs b/src/payloads/send_video_note.rs index 417bc1ac..a8c69ce7 100644 --- a/src/payloads/send_video_note.rs +++ b/src/payloads/send_video_note.rs @@ -39,6 +39,8 @@ impl_payload! { /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages pub disable_notification: bool, + /// Protects the contents of sent messages from forwarding and saving + pub protect_content: bool, /// If the message is a reply, ID of the original message pub reply_to_message_id: i32, /// Pass _True_, if the message should be sent even if the specified replied-to message is not found diff --git a/src/types/message_entity.rs b/src/types/message_entity.rs index cd8b6278..7fe19381 100644 --- a/src/types/message_entity.rs +++ b/src/types/message_entity.rs @@ -64,6 +64,7 @@ pub enum MessageEntityKind { TextMention { user: User }, Underline, Strikethrough, + Spoiler, } #[cfg(test)] diff --git a/src/types/parse_mode.rs b/src/types/parse_mode.rs index 88a42c48..edd652fe 100644 --- a/src/types/parse_mode.rs +++ b/src/types/parse_mode.rs @@ -12,13 +12,20 @@ use serde::{Deserialize, Serialize}; /// Formatting options. /// /// The Bot API supports basic formatting for messages. You can use bold, -/// italic, underlined and strikethrough text, as well as inline links and -/// pre-formatted code in your bots' messages. Telegram clients will render +/// italic, underlined, strikethrough, and spoiler text, as well as inline links +/// and pre-formatted code in your bots' messages. Telegram clients will render /// them accordingly. You can use either markdown-style or HTML-style /// formatting. /// /// Note that Telegram clients will display an **alert** to the user before -/// opening an inline link (‘Open this link?’ together with the full URL). +/// opening an inline link ('Open this link?' together with the full URL). +/// +/// Message entities can be nested, providing following restrictions are met: +/// - If two entities have common characters then one of them is fully contained +/// inside another. +/// - bold, italic, underline, strikethrough, and spoiler entities can contain +/// and can be part of any other entities, except pre and code. +/// - All other entities can't contain each other. /// /// Links `tg://user?id=` can be used to mention a user by their ID /// without using a username. Please note: @@ -39,7 +46,8 @@ use serde::{Deserialize, Serialize}; /// _italic \*text_ /// __underline__ /// ~strikethrough~ -/// *bold _italic bold ~italic bold strikethrough~ __underline italic bold___ bold* +/// ||spoiler|| +/// *bold _italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ __underline italic bold___ bold* /// [inline URL](http://www.example.com/) /// [inline mention of a user](tg://user?id=123456789) /// `inline fixed-width code` @@ -77,9 +85,10 @@ use serde::{Deserialize, Serialize}; /// italic, italic /// underline, underline /// strikethrough, strikethrough, strikethrough -/// bold italic bold italic bold strikethrough underline italic bold bold -/// inline URL -/// inline mention of a user +/// spoiler, spoiler +/// bold italic bold italic bold strikethrough italic bold strikethrough spoiler underline italic bold bold +/// inline URL +/// inline mention of a user /// inline fixed-width code ///
pre-formatted fixed-width code block
#[doc = "
pre-formatted fixed-width code block written in the \