Skip to content

Commit

Permalink
Merge pull request #46 from Desiders/add-support-bot-api-7.11
Browse files Browse the repository at this point in the history
Add support Bot API 7.11
  • Loading branch information
Desiders authored Nov 1, 2024
2 parents d519569 + e33eae0 commit d172c27
Show file tree
Hide file tree
Showing 27 changed files with 467 additions and 9 deletions.
19 changes: 19 additions & 0 deletions telers/src/methods/copy_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub struct CopyMessage {
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
pub protect_content: Option<bool>,
/// Pass `true` to allow up to 1000 messages per second, ignoring [broadcasting limits](https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once) for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
pub allow_paid_broadcast: Option<bool>,
/// Description of the message to reply to
pub reply_parameters: Option<ReplyParameters>,
/// Additional interface options. A JSON-serialized object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards), [custom reply keyboard](https://core.telegram.org/bots/features#keyboards), instructions to remove reply keyboard or to force a reply from the user.
Expand All @@ -60,6 +62,7 @@ impl CopyMessage {
show_caption_above_media: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
reply_parameters: None,
reply_markup: None,
}
Expand Down Expand Up @@ -165,6 +168,14 @@ impl CopyMessage {
}
}

#[must_use]
pub fn allow_paid_broadcast(self, val: bool) -> Self {
Self {
allow_paid_broadcast: Some(val),
..self
}
}

#[must_use]
pub fn reply_parameters(self, val: ReplyParameters) -> Self {
Self {
Expand Down Expand Up @@ -248,6 +259,14 @@ impl CopyMessage {
}
}

#[must_use]
pub fn allow_paid_broadcast_option(self, val: Option<bool>) -> Self {
Self {
allow_paid_broadcast: val,
..self
}
}

#[must_use]
pub fn reply_parameters_option(self, val: Option<ReplyParameters>) -> Self {
Self {
Expand Down
4 changes: 3 additions & 1 deletion telers/src/methods/edit_message_media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ use crate::{
use serde::Serialize;
use serde_with::skip_serializing_none;

/// Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its `file_id` or specify a URL.
/// Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL
/// # Documentation
/// <https://core.telegram.org/bots/api#editmessagemedia>
/// # Notes
/// Business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
/// # Returns
/// On success, if the edited message is not an inline message, the edited [`crate::types::Message`] is returned, otherwise `true` is returned
#[skip_serializing_none]
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/forward_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct ForwardMessage {
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
pub protect_content: Option<bool>,
/// Pass `true` to allow up to 1000 messages per second, ignoring [broadcasting limits](https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once) for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
pub allow_paid_broadcast: Option<bool>,
}

impl ForwardMessage {
Expand All @@ -44,6 +46,7 @@ impl ForwardMessage {
message_id,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
}
}

Expand Down Expand Up @@ -94,6 +97,14 @@ impl ForwardMessage {
..self
}
}

#[must_use]
pub fn allow_paid_broadcast(self, val: bool) -> Self {
Self {
allow_paid_broadcast: Some(val),
..self
}
}
}

impl ForwardMessage {
Expand All @@ -120,6 +131,14 @@ impl ForwardMessage {
..self
}
}

#[must_use]
pub fn allow_paid_broadcast_option(self, val: Option<bool>) -> Self {
Self {
allow_paid_broadcast: val,
..self
}
}
}

impl TelegramMethod for ForwardMessage {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/send_animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub struct SendAnimation<'a> {
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
pub protect_content: Option<bool>,
/// Pass `true` to allow up to 1000 messages per second, ignoring [broadcasting limits](https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once) for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
pub allow_paid_broadcast: Option<bool>,
/// Unique identifier of the message effect to be added to the message; for private chats only
pub message_effect_id: Option<String>,
/// Description of the message to reply to
Expand Down Expand Up @@ -76,6 +78,7 @@ impl<'a> SendAnimation<'a> {
supports_streaming: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
Expand Down Expand Up @@ -230,6 +233,14 @@ impl<'a> SendAnimation<'a> {
}
}

#[must_use]
pub fn allow_paid_broadcast(self, val: bool) -> Self {
Self {
allow_paid_broadcast: Some(val),
..self
}
}

#[must_use]
pub fn message_effect_id(self, val: impl Into<String>) -> Self {
Self {
Expand Down Expand Up @@ -374,6 +385,14 @@ impl<'a> SendAnimation<'a> {
}
}

#[must_use]
pub fn allow_paid_broadcast_option(self, val: Option<bool>) -> Self {
Self {
allow_paid_broadcast: val,
..self
}
}

#[must_use]
pub fn message_effect_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/send_audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pub struct SendAudio<'a> {
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
pub protect_content: Option<bool>,
/// Pass `true` to allow up to 1000 messages per second, ignoring [broadcasting limits](https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once) for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
pub allow_paid_broadcast: Option<bool>,
/// Unique identifier of the message effect to be added to the message; for private chats only
pub message_effect_id: Option<String>,
/// Description of the message to reply to
Expand All @@ -67,6 +69,7 @@ impl<'a> SendAudio<'a> {
thumbnail: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
Expand Down Expand Up @@ -197,6 +200,14 @@ impl<'a> SendAudio<'a> {
}
}

#[must_use]
pub fn allow_paid_broadcast(self, val: bool) -> Self {
Self {
allow_paid_broadcast: Some(val),
..self
}
}

#[must_use]
pub fn message_effect_id(self, val: impl Into<String>) -> Self {
Self {
Expand Down Expand Up @@ -320,6 +331,14 @@ impl<'a> SendAudio<'a> {
}
}

#[must_use]
pub fn allow_paid_broadcast_option(self, val: Option<bool>) -> Self {
Self {
allow_paid_broadcast: val,
..self
}
}

#[must_use]
pub fn message_effect_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/send_contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ pub struct SendContact {
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
pub protect_content: Option<bool>,
/// Pass `true` to allow up to 1000 messages per second, ignoring [broadcasting limits](https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once) for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
pub allow_paid_broadcast: Option<bool>,
/// Unique identifier of the message effect to be added to the message; for private chats only
pub message_effect_id: Option<String>,
/// Description of the message to reply to
Expand All @@ -59,6 +61,7 @@ impl SendContact {
vcard: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
Expand Down Expand Up @@ -137,6 +140,14 @@ impl SendContact {
}
}

#[must_use]
pub fn allow_paid_broadcast(self, val: bool) -> Self {
Self {
allow_paid_broadcast: Some(val),
..self
}
}

#[must_use]
pub fn message_effect_id(self, val: impl Into<String>) -> Self {
Self {
Expand Down Expand Up @@ -211,6 +222,14 @@ impl SendContact {
}
}

#[must_use]
pub fn allow_paid_broadcast_option(self, val: Option<bool>) -> Self {
Self {
allow_paid_broadcast: val,
..self
}
}

#[must_use]
pub fn message_effect_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/send_dice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct SendDice {
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
pub protect_content: Option<bool>,
/// Pass `true` to allow up to 1000 messages per second, ignoring [broadcasting limits](https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once) for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
pub allow_paid_broadcast: Option<bool>,
/// Unique identifier of the message effect to be added to the message; for private chats only
pub message_effect_id: Option<String>,
/// Description of the message to reply to
Expand All @@ -46,6 +48,7 @@ impl SendDice {
emoji: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
Expand Down Expand Up @@ -100,6 +103,14 @@ impl SendDice {
}
}

#[must_use]
pub fn allow_paid_broadcast(self, val: bool) -> Self {
Self {
allow_paid_broadcast: Some(val),
..self
}
}

#[must_use]
pub fn message_effect_id(self, val: impl Into<String>) -> Self {
Self {
Expand Down Expand Up @@ -166,6 +177,14 @@ impl SendDice {
}
}

#[must_use]
pub fn allow_paid_broadcast_option(self, val: Option<bool>) -> Self {
Self {
allow_paid_broadcast: val,
..self
}
}

#[must_use]
pub fn message_effect_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/send_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub struct SendDocument<'a> {
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
pub protect_content: Option<bool>,
/// Pass `true` to allow up to 1000 messages per second, ignoring [broadcasting limits](https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once) for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
pub allow_paid_broadcast: Option<bool>,
/// Unique identifier of the message effect to be added to the message; for private chats only
pub message_effect_id: Option<String>,
/// Description of the message to reply to
Expand All @@ -61,6 +63,7 @@ impl<'a> SendDocument<'a> {
disable_content_type_detection: None,
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
Expand Down Expand Up @@ -175,6 +178,14 @@ impl<'a> SendDocument<'a> {
}
}

#[must_use]
pub fn allow_paid_broadcast(self, val: bool) -> Self {
Self {
allow_paid_broadcast: Some(val),
..self
}
}

#[must_use]
pub fn message_effect_id(self, val: impl Into<String>) -> Self {
Self {
Expand Down Expand Up @@ -274,6 +285,14 @@ impl<'a> SendDocument<'a> {
}
}

#[must_use]
pub fn allow_paid_broadcast_option(self, val: Option<bool>) -> Self {
Self {
allow_paid_broadcast: val,
..self
}
}

#[must_use]
pub fn message_effect_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
Expand Down
19 changes: 19 additions & 0 deletions telers/src/methods/send_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct SendGame {
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
pub protect_content: Option<bool>,
/// Pass `true` to allow up to 1000 messages per second, ignoring [broadcasting limits](https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once) for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
pub allow_paid_broadcast: Option<bool>,
/// Unique identifier of the message effect to be added to the message; for private chats only
pub message_effect_id: Option<String>,
/// Description of the message to reply to
Expand All @@ -46,6 +48,7 @@ impl SendGame {
game_short_name: game_short_name.into(),
disable_notification: None,
protect_content: None,
allow_paid_broadcast: None,
message_effect_id: None,
reply_parameters: None,
reply_markup: None,
Expand Down Expand Up @@ -100,6 +103,14 @@ impl SendGame {
}
}

#[must_use]
pub fn allow_paid_broadcast(self, val: bool) -> Self {
Self {
allow_paid_broadcast: Some(val),
..self
}
}

#[must_use]
pub fn message_effect_id(self, val: impl Into<String>) -> Self {
Self {
Expand Down Expand Up @@ -158,6 +169,14 @@ impl SendGame {
}
}

#[must_use]
pub fn allow_paid_broadcast_option(self, val: Option<bool>) -> Self {
Self {
allow_paid_broadcast: val,
..self
}
}

#[must_use]
pub fn message_effect_id_option(self, val: Option<impl Into<String>>) -> Self {
Self {
Expand Down
Loading

0 comments on commit d172c27

Please sign in to comment.