From 161200f60523ff0c69d01e5dded37a212539eb95 Mon Sep 17 00:00:00 2001 From: Niklas Weimann Date: Fri, 6 Sep 2024 17:46:22 +0200 Subject: [PATCH 1/2] Add support for v7.10 --- src/RxTelegram.Bot/Api/UpdateManager.cs | 1 + .../Interface/BaseTypes/ChatBoostSourceGiveaway.cs | 5 +++++ .../Interface/BaseTypes/Enums/UpdateType.cs | 2 ++ .../BaseTypes/Requests/Messages/SendPaidMedia.cs | 5 +++++ src/RxTelegram.Bot/Interface/Giveaway/Giveaway.cs | 5 +++++ .../Interface/Giveaway/GiveawayCompleted.cs | 5 +++++ .../Interface/Giveaway/GiveawayCreated.cs | 4 ++++ .../Interface/Giveaway/GiveawayWinners.cs | 5 +++++ .../Interface/Payments/PaidMediaPurchased.cs | 10 ++++++++++ .../Interface/Payments/TransactionPartnerUser.cs | 8 ++++++++ src/RxTelegram.Bot/Interface/Setup/Update.cs | 5 +++++ 11 files changed, 55 insertions(+) create mode 100644 src/RxTelegram.Bot/Interface/Payments/PaidMediaPurchased.cs diff --git a/src/RxTelegram.Bot/Api/UpdateManager.cs b/src/RxTelegram.Bot/Api/UpdateManager.cs index 01070ff..cdc386d 100644 --- a/src/RxTelegram.Bot/Api/UpdateManager.cs +++ b/src/RxTelegram.Bot/Api/UpdateManager.cs @@ -187,6 +187,7 @@ internal void DistributeUpdates(Update[] updates) var updateStrategies = new List> { update => OnNext(UpdateType.PreCheckoutQuery, update.PreCheckoutQuery), + update => OnNext(UpdateType.PurchasedPaidMedia, update.PurchasedPaidMedia), update => OnNext(UpdateType.ShippingQuery, update.ShippingQuery), update => OnNext(UpdateType.EditedChannelPost, update.EditedChannelPost), update => OnNext(UpdateType.ChannelPost, update.ChannelPost), diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/ChatBoostSourceGiveaway.cs b/src/RxTelegram.Bot/Interface/BaseTypes/ChatBoostSourceGiveaway.cs index aeaa7a4..f3aa760 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/ChatBoostSourceGiveaway.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/ChatBoostSourceGiveaway.cs @@ -24,6 +24,11 @@ public class ChatBoostSourceGiveaway : ChatBoostSource /// public User User { get; set; } + /// + /// Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + /// + public int PrizeStarCount { get; set; } + /// /// Optional. True, if the giveaway was completed, but there was no user to win the prize /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Enums/UpdateType.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Enums/UpdateType.cs index ccff91f..48c63cd 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Enums/UpdateType.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Enums/UpdateType.cs @@ -20,6 +20,8 @@ public enum UpdateType PreCheckoutQuery, + PurchasedPaidMedia, + Poll, PollAnswer, diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs index 1ed0f83..0b244b3 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs @@ -26,6 +26,11 @@ public class SendPaidMedia : BaseTextRequest /// public List Media { get; set; } + /// + /// Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes. + /// + public string Payload { get; set; } + /// /// Media caption, 0-1024 characters after entities parsing /// diff --git a/src/RxTelegram.Bot/Interface/Giveaway/Giveaway.cs b/src/RxTelegram.Bot/Interface/Giveaway/Giveaway.cs index c21eaf5..cfa18cf 100644 --- a/src/RxTelegram.Bot/Interface/Giveaway/Giveaway.cs +++ b/src/RxTelegram.Bot/Interface/Giveaway/Giveaway.cs @@ -45,6 +45,11 @@ public class Giveaway /// public List CountryCodes { get; set; } + /// + /// Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + /// + public int PrizeStarCount { get; set; } + /// /// Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for /// diff --git a/src/RxTelegram.Bot/Interface/Giveaway/GiveawayCompleted.cs b/src/RxTelegram.Bot/Interface/Giveaway/GiveawayCompleted.cs index d1ffa75..3d190bd 100644 --- a/src/RxTelegram.Bot/Interface/Giveaway/GiveawayCompleted.cs +++ b/src/RxTelegram.Bot/Interface/Giveaway/GiveawayCompleted.cs @@ -21,4 +21,9 @@ public class GiveawayCompleted /// Optional. Message with the giveaway that was completed, if it wasn't deleted /// public Message GiveawayMessage { get; set; } + + /// + /// Optional. True, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway. + /// + public bool IsStarGiveaway { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/Giveaway/GiveawayCreated.cs b/src/RxTelegram.Bot/Interface/Giveaway/GiveawayCreated.cs index 3664c98..40e8ea2 100644 --- a/src/RxTelegram.Bot/Interface/Giveaway/GiveawayCreated.cs +++ b/src/RxTelegram.Bot/Interface/Giveaway/GiveawayCreated.cs @@ -5,4 +5,8 @@ namespace RxTelegram.Bot.Interface.Giveaway; /// public class GiveawayCreated { + /// + /// Optional. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only + /// + public int? PrizeStarCount { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/Giveaway/GiveawayWinners.cs b/src/RxTelegram.Bot/Interface/Giveaway/GiveawayWinners.cs index 929c357..dee03ee 100644 --- a/src/RxTelegram.Bot/Interface/Giveaway/GiveawayWinners.cs +++ b/src/RxTelegram.Bot/Interface/Giveaway/GiveawayWinners.cs @@ -39,6 +39,11 @@ public class GiveawayWinners /// public int AdditionalChatCount { get; set; } + /// + /// Optional. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only + /// + public int PrizeStarCount { get; set; } + /// /// Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for /// diff --git a/src/RxTelegram.Bot/Interface/Payments/PaidMediaPurchased.cs b/src/RxTelegram.Bot/Interface/Payments/PaidMediaPurchased.cs new file mode 100644 index 0000000..f0b3689 --- /dev/null +++ b/src/RxTelegram.Bot/Interface/Payments/PaidMediaPurchased.cs @@ -0,0 +1,10 @@ +using RxTelegram.Bot.Interface.BaseTypes; + +namespace RxTelegram.Bot.Interface.Payments; + +public class PaidMediaPurchased +{ + public User From { get; set; } + + public string PaidMediaPayload { get; set; } +} diff --git a/src/RxTelegram.Bot/Interface/Payments/TransactionPartnerUser.cs b/src/RxTelegram.Bot/Interface/Payments/TransactionPartnerUser.cs index 88342e0..dfef942 100644 --- a/src/RxTelegram.Bot/Interface/Payments/TransactionPartnerUser.cs +++ b/src/RxTelegram.Bot/Interface/Payments/TransactionPartnerUser.cs @@ -24,5 +24,13 @@ public class TransactionPartnerUser : TransactionPartner /// public string InvoicePayload { get; set; } + /// + /// Optional. Information about the paid media bought by the user + /// public List PaidMedia { get; set; } + + /// + /// Optional. Bot-specified paid media payload + /// + public string PaidMediaPayload { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/Setup/Update.cs b/src/RxTelegram.Bot/Interface/Setup/Update.cs index c38a069..b27ff3e 100644 --- a/src/RxTelegram.Bot/Interface/Setup/Update.cs +++ b/src/RxTelegram.Bot/Interface/Setup/Update.cs @@ -100,6 +100,11 @@ public class Update /// public PreCheckoutQuery PreCheckoutQuery { get; set; } + /// + /// Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat + /// + public PaidMediaPurchased PurchasedPaidMedia { get; set; } + /// /// New poll state. Bots receive only updates about polls, which are sent or stopped by the bot /// From f417f2c31d6a7417961ed6e1aec4ba70d8a2f79e Mon Sep 17 00:00:00 2001 From: Niklas Weimann Date: Fri, 6 Sep 2024 17:47:10 +0200 Subject: [PATCH 2/2] Update version to 7.10 --- README.md | 2 +- src/RxTelegram.Bot/RxTelegram.Bot.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b706ef3..80179f8 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.9 (as at August 14, 2024). +RxTelegram.Bot supports Telegram Bot API 7.10 (as at September 6, 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/RxTelegram.Bot.csproj b/src/RxTelegram.Bot/RxTelegram.Bot.csproj index efbb67c..7bbe5c5 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.9.0 + 7.10.0 icon.png true bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml