From 78838d2c68dc7374295f65b1e951b807d2d2f7a1 Mon Sep 17 00:00:00 2001 From: Niklas Weimann Date: Mon, 4 Nov 2024 22:51:22 +0100 Subject: [PATCH] Add support for api v7.11 Signed-off-by: Niklas Weimann --- README.md | 2 +- .../Interface/BaseTypes/CopyTextButton.cs | 12 ++++++++++++ .../BaseTypes/Enums/TransactionPartnerType.cs | 5 ++++- .../Interface/BaseTypes/InlineKeyboardButton.cs | 5 +++++ .../BaseTypes/Requests/Attachments/SendAnimation.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendAudio.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendContact.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendDocument.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendLocation.cs | 8 +++++++- .../Requests/Attachments/SendMediaGroup.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendPhoto.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendPoll.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendVenue.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendVideo.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendVideoNote.cs | 8 +++++++- .../BaseTypes/Requests/Attachments/SendVoice.cs | 8 +++++++- .../Requests/Base/Interfaces/IAllowPaidBroadcast.cs | 10 ++++++++++ .../BaseTypes/Requests/Messages/CopyMessage.cs | 8 +++++++- .../BaseTypes/Requests/Messages/SendDice.cs | 8 +++++++- .../BaseTypes/Requests/Messages/SendMessage.cs | 8 +++++++- .../BaseTypes/Requests/Messages/SendPaidMedia.cs | 8 +++++++- .../Interface/Games/Requests/SendGame.cs | 8 +++++++- .../Interface/Payments/Requests/SendInvoice.cs | 8 +++++++- .../Payments/TransactionPartnerTelegramApi.cs | 13 +++++++++++++ .../Interface/Stickers/Requests/SendSticker.cs | 8 +++++++- src/RxTelegram.Bot/RxTelegram.Bot.csproj | 2 +- 26 files changed, 179 insertions(+), 22 deletions(-) create mode 100644 src/RxTelegram.Bot/Interface/BaseTypes/CopyTextButton.cs create mode 100644 src/RxTelegram.Bot/Interface/BaseTypes/Requests/Base/Interfaces/IAllowPaidBroadcast.cs create mode 100644 src/RxTelegram.Bot/Interface/Payments/TransactionPartnerTelegramApi.cs diff --git a/README.md b/README.md index 80179f8..19d0a42 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=coverage)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot) -RxTelegram.Bot supports Telegram Bot API 7.10 (as at September 6, 2024). +RxTelegram.Bot supports Telegram Bot API 7.11 (as at October 31, 2024). This is a reactive designed .NET Library for the Telegram Bot API. It works with the official [Reactive Extentions](https://github.com/dotnet/reactive). diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/CopyTextButton.cs b/src/RxTelegram.Bot/Interface/BaseTypes/CopyTextButton.cs new file mode 100644 index 0000000..c8572ea --- /dev/null +++ b/src/RxTelegram.Bot/Interface/BaseTypes/CopyTextButton.cs @@ -0,0 +1,12 @@ +namespace RxTelegram.Bot.Interface.BaseTypes; + +/// +/// This object represents an inline keyboard button that copies specified text to the clipboard. +/// +public class CopyTextButton +{ + /// + /// The text to be copied to the clipboard; 1-256 characters + /// + public string Text { get; set; } +} diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Enums/TransactionPartnerType.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Enums/TransactionPartnerType.cs index bea387d..07cfc09 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Enums/TransactionPartnerType.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Enums/TransactionPartnerType.cs @@ -17,5 +17,8 @@ public enum TransactionPartnerType [ImplementationType(typeof(TransactionPartnerOther))] - Other + Other, + + [ImplementationType(typeof(TransactionPartnerTelegramApi))] + TelegramApi } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/InlineKeyboardButton.cs b/src/RxTelegram.Bot/Interface/BaseTypes/InlineKeyboardButton.cs index 9ad1a16..a383965 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/InlineKeyboardButton.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/InlineKeyboardButton.cs @@ -57,6 +57,11 @@ public class InlineKeyboardButton /// public string SwitchInlineQueryCurrentChat { get; set; } + /// + /// Optional. Description of the button that copies the specified text to the clipboard. + /// + public CopyTextButton CopyTextButton { get; set; } + /// /// Optional. Description of the game that will be launched when the user presses the button. /// NOTE: This type of button must always be the first button in the first row. diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAnimation.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAnimation.cs index b960937..7281989 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAnimation.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAnimation.cs @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; /// 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. /// -public class SendAnimation : BaseSend, IProtectContent +public class SendAnimation : BaseSend, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -87,4 +87,10 @@ public class SendAnimation : BaseSend, IProtectContent public bool? ProtectContent { get; set; } protected override IValidationResult Validate() => this.CreateValidation(); + + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAudio.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAudio.cs index e7ff8a1..5b6152a 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAudio.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAudio.cs @@ -11,7 +11,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; /// limit may be changed in the future. /// For sending voice messages, use the sendVoice method instead. /// -public class SendAudio : BaseSend, IProtectContent +public class SendAudio : BaseSend, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -79,4 +79,10 @@ public class SendAudio : BaseSend, IProtectContent public bool? ProtectContent { get; set; } protected override IValidationResult Validate() => this.CreateValidation(); + + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendContact.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendContact.cs index 6fa048c..406c18d 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendContact.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendContact.cs @@ -7,7 +7,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; /// /// Use this method to send phone contacts. On success, the sent Message is returned. /// -public class SendContact : BaseRequest, IProtectContent +public class SendContact : BaseRequest, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -69,5 +69,11 @@ public class SendContact : BaseRequest, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendDocument.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendDocument.cs index a895ece..ac0863d 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendDocument.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendDocument.cs @@ -5,7 +5,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; -public class SendDocument : BaseSend, IProtectContent +public class SendDocument : BaseSend, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -53,4 +53,10 @@ public class SendDocument : BaseSend, IProtectContent public bool? ProtectContent { get; set; } protected override IValidationResult Validate() => this.CreateValidation(); + + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendLocation.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendLocation.cs index 8b2ce3c..79db0f5 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendLocation.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendLocation.cs @@ -4,7 +4,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; -public class SendLocation : BaseRequest, IProtectContent +public class SendLocation : BaseRequest, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -75,5 +75,11 @@ public class SendLocation : BaseRequest, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendMediaGroup.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendMediaGroup.cs index 446622d..ccc18a9 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendMediaGroup.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendMediaGroup.cs @@ -6,7 +6,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; -public class SendMediaGroup : BaseRequest, IProtectContent +public class SendMediaGroup : BaseRequest, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -43,5 +43,11 @@ public class SendMediaGroup : BaseRequest, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPhoto.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPhoto.cs index ea36839..1fd301e 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPhoto.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPhoto.cs @@ -5,7 +5,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; -public class SendPhoto : BaseSend, IProtectContent +public class SendPhoto : BaseSend, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -53,4 +53,10 @@ public class SendPhoto : BaseSend, IProtectContent public bool? ProtectContent { get; set; } protected override IValidationResult Validate() => this.CreateValidation(); + + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPoll.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPoll.cs index 51bf24c..a8add88 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPoll.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPoll.cs @@ -10,7 +10,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; /// /// Use this method to send a native poll. On success, the sent Message is returned. /// -public class SendPoll : BaseRequest, IProtectContent +public class SendPoll : BaseRequest, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -128,5 +128,11 @@ public class SendPoll : BaseRequest, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVenue.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVenue.cs index 37e81ab..af4ef77 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVenue.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVenue.cs @@ -7,7 +7,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; /// /// Use this method to send information about a venue. On success, the sent Message is returned. /// -public class SendVenue : BaseRequest, IProtectContent +public class SendVenue : BaseRequest, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -93,5 +93,11 @@ public class SendVenue : BaseRequest, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideo.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideo.cs index e0a1fe9..4482ecc 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideo.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideo.cs @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; /// 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. /// -public class SendVideo : BaseSend, IProtectContent +public class SendVideo : BaseSend, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -90,4 +90,10 @@ public class SendVideo : BaseSend, IProtectContent public bool? ProtectContent { get; set; } protected override IValidationResult Validate() => this.CreateValidation(); + + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideoNote.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideoNote.cs index ba56cf0..da071d8 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideoNote.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideoNote.cs @@ -8,7 +8,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; /// 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. /// -public class SendVideoNote : BaseSend, IProtectContent +public class SendVideoNote : BaseSend, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -59,5 +59,11 @@ public class SendVideoNote : BaseSend, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVoice.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVoice.cs index ee5da9d..c0ce0c3 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVoice.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVoice.cs @@ -10,7 +10,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Attachments; /// your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message /// is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. /// -public class SendVoice : BaseSend, IProtectContent +public class SendVoice : BaseSend, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -56,5 +56,11 @@ public class SendVoice : BaseSend, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Base/Interfaces/IAllowPaidBroadcast.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Base/Interfaces/IAllowPaidBroadcast.cs new file mode 100644 index 0000000..faf8835 --- /dev/null +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Base/Interfaces/IAllowPaidBroadcast.cs @@ -0,0 +1,10 @@ +namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Base.Interfaces; + +public interface IAllowPaidBroadcast +{ + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } +} diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/CopyMessage.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/CopyMessage.cs index 49e37ca..5ee8b5d 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/CopyMessage.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/CopyMessage.cs @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages; /// Use this method to copy messages of any kind. The method is analogous to the method forwardMessages, /// but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. /// -public class CopyMessage : BaseSend, IProtectContent +public class CopyMessage : BaseSend, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only @@ -54,5 +54,11 @@ public class CopyMessage : BaseSend, IProtectContent /// public bool ShowCaptionAboveMedia { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendDice.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendDice.cs index 0c12c32..e7cfd47 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendDice.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendDice.cs @@ -8,7 +8,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages; /// Use this method to send a dice, which will have a random value from 1 to 6. On success, the sent Message is returned. /// (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!) /// -public class SendDice : BaseRequest, IProtectContent +public class SendDice : BaseRequest, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -52,5 +52,11 @@ public class SendDice : BaseRequest, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendMessage.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendMessage.cs index b238ec0..1c1a841 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendMessage.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendMessage.cs @@ -5,7 +5,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages; -public class SendMessage : BaseTextRequest, IProtectContent +public class SendMessage : BaseTextRequest, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -62,4 +62,10 @@ public class SendMessage : BaseTextRequest, IProtectContent public bool? ProtectContent { get; set; } protected override IValidationResult Validate() => this.CreateValidation(); + + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs index 0b244b3..cc7012c 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages; /// /// Use this method to send paid media to channel chats. On success, the sent Message is returned. /// -public class SendPaidMedia : BaseTextRequest +public class SendPaidMedia : BaseTextRequest, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -69,5 +69,11 @@ public class SendPaidMedia : BaseTextRequest /// public IReplyMarkup ReplyMarkup { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/Games/Requests/SendGame.cs b/src/RxTelegram.Bot/Interface/Games/Requests/SendGame.cs index 44651ae..5b77984 100644 --- a/src/RxTelegram.Bot/Interface/Games/Requests/SendGame.cs +++ b/src/RxTelegram.Bot/Interface/Games/Requests/SendGame.cs @@ -8,7 +8,7 @@ namespace RxTelegram.Bot.Interface.Games.Requests; /// /// Use this method to send a game. On success, the sent Message is returned. /// -public class SendGame : BaseRequest, IProtectContent +public class SendGame : BaseRequest, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -52,5 +52,11 @@ public class SendGame : BaseRequest, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/Payments/Requests/SendInvoice.cs b/src/RxTelegram.Bot/Interface/Payments/Requests/SendInvoice.cs index 6cefd17..1bfbe3a 100644 --- a/src/RxTelegram.Bot/Interface/Payments/Requests/SendInvoice.cs +++ b/src/RxTelegram.Bot/Interface/Payments/Requests/SendInvoice.cs @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.Payments.Requests; /// /// Use this method to send invoices. On success, the sent Message is returned. /// -public class SendInvoice : BaseValidation, IProtectContent +public class SendInvoice : BaseValidation, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only @@ -183,5 +183,11 @@ public class SendInvoice : BaseValidation, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/Payments/TransactionPartnerTelegramApi.cs b/src/RxTelegram.Bot/Interface/Payments/TransactionPartnerTelegramApi.cs new file mode 100644 index 0000000..b9d36af --- /dev/null +++ b/src/RxTelegram.Bot/Interface/Payments/TransactionPartnerTelegramApi.cs @@ -0,0 +1,13 @@ +using RxTelegram.Bot.Interface.BaseTypes.Enums; + +namespace RxTelegram.Bot.Interface.Payments; + +/// +/// Describes a transaction with payment for paid broadcasting. +/// +public class TransactionPartnerTelegramApi : TransactionPartner +{ + public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.TelegramApi; + + public int RequestCount { get; set; } +} diff --git a/src/RxTelegram.Bot/Interface/Stickers/Requests/SendSticker.cs b/src/RxTelegram.Bot/Interface/Stickers/Requests/SendSticker.cs index 39f2ef8..3d69765 100644 --- a/src/RxTelegram.Bot/Interface/Stickers/Requests/SendSticker.cs +++ b/src/RxTelegram.Bot/Interface/Stickers/Requests/SendSticker.cs @@ -9,7 +9,7 @@ namespace RxTelegram.Bot.Interface.Stickers.Requests; /// /// Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned. /// -public class SendSticker : BaseValidation, IProtectContent +public class SendSticker : BaseValidation, IProtectContent, IAllowPaidBroadcast { /// /// Unique identifier of the business connection on behalf of which the message will be sent @@ -67,5 +67,11 @@ public class SendSticker : BaseValidation, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. + /// The relevant Stars will be withdrawn from the bot's balance + /// + public bool? AllowPaidBroadcast { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/RxTelegram.Bot.csproj b/src/RxTelegram.Bot/RxTelegram.Bot.csproj index 7bbe5c5..70f073a 100644 --- a/src/RxTelegram.Bot/RxTelegram.Bot.csproj +++ b/src/RxTelegram.Bot/RxTelegram.Bot.csproj @@ -10,7 +10,7 @@ https://github.com/RxTelegram/RxTelegram.Bot git Telegram;Bot;Api;Rx;Reactive;Observable;RxTelegram;RxTelegram.Bot - 7.10.0 + 7.11.0 icon.png true bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml