Add support for TBA 5.6

This commit is contained in:
Maybe Waffle 2022-01-03 21:41:57 +03:00
parent 4af317e1fd
commit 7223270b32
21 changed files with 54 additions and 8 deletions

View file

@ -15,7 +15,7 @@
<img src="https://img.shields.io/badge/license-MIT-blue.svg">
</a>
<a href="https://core.telegram.org/bots/api">
<img src="https://img.shields.io/badge/API%20coverage-Up%20to%205.3%20(inclusively)-green.svg">
<img src="https://img.shields.io/badge/API%20coverage-Up%20to%205.6%20(inclusively)-green.svg">
</a>
<a href="https://crates.io/crates/teloxide_core">
<img src="https://img.shields.io/crates/v/teloxide_core.svg">

View file

@ -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

View file

@ -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,
}
}
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -64,6 +64,7 @@ pub enum MessageEntityKind {
TextMention { user: User },
Underline,
Strikethrough,
Spoiler,
}
#[cfg(test)]

View file

@ -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=<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};
/// <i>italic</i>, <em>italic</em>
/// <u>underline</u>, <ins>underline</ins>
/// <s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>
/// <b>bold <i>italic bold <s>italic bold strikethrough</s> <u>underline italic bold</u></i> bold</b>
/// <a href="http:// www.example.com/">inline URL</a>
/// <a href="tg:// user?id=123456789">inline mention of a user</a>
/// <span class="tg-spoiler">spoiler</span>, <tg-spoiler>spoiler</tg-spoiler>
/// <b>bold <i>italic bold <s>italic bold strikethrough <span class="tg-spoiler">italic bold strikethrough spoiler</span></s> <u>underline italic bold</u></i> bold</b>
/// <a href="http://www.example.com/">inline URL</a>
/// <a href="tg://user?id=123456789">inline mention of a user</a>
/// <code>inline fixed-width code</code>
/// <pre>pre-formatted fixed-width code block</pre>
#[doc = "<pre><code class=\"language-rust\">pre-formatted fixed-width code block written in the \