diff --git a/README.md b/README.md index b0bf58f..a394992 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 8.1 (as at December 4, 2024). +RxTelegram.Bot supports Telegram Bot API 8.2 (as at January 1, 2025). 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/InlineMode/InlineQueryResults/InlineQueryResultArticle.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultArticle.cs index 3bd6ac1..c52c478 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultArticle.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultArticle.cs @@ -15,12 +15,6 @@ public class InlineQueryResultArticle : BaseInlineQueryResultMedia /// public string Url { get; set; } - /// - /// Optional. - /// Pass True, if you don't want the URL to be shown in the message - /// - public bool? HideUrl { get; set; } - /// /// Optional. /// Short description of the result @@ -46,4 +40,4 @@ public class InlineQueryResultArticle : BaseInlineQueryResultMedia public int? ThumbnailHeight { get; set; } protected override IValidationResult Validate() => this.CreateValidation(); -} \ No newline at end of file +} diff --git a/src/RxTelegram.Bot/Interface/Stickers/Gift.cs b/src/RxTelegram.Bot/Interface/Stickers/Gift.cs index 8b21216..7819ee4 100644 --- a/src/RxTelegram.Bot/Interface/Stickers/Gift.cs +++ b/src/RxTelegram.Bot/Interface/Stickers/Gift.cs @@ -20,6 +20,11 @@ public class Gift /// public int StarCount { get; set; } + /// + /// Optional. The number of Telegram Stars that must be paid to upgrade the gift to a unique one + /// + public int? UpgradeStarCount { get; set; } + /// /// Optional. The total number of the gifts of this type that can be sent; for limited gifts only /// diff --git a/src/RxTelegram.Bot/Interface/Stickers/Requests/RemoveChatVerification.cs b/src/RxTelegram.Bot/Interface/Stickers/Requests/RemoveChatVerification.cs new file mode 100644 index 0000000..b62a7d6 --- /dev/null +++ b/src/RxTelegram.Bot/Interface/Stickers/Requests/RemoveChatVerification.cs @@ -0,0 +1,19 @@ +using RxTelegram.Bot.Interface.BaseTypes; +using RxTelegram.Bot.Interface.Validation; +using RxTelegram.Bot.Validation; + +namespace RxTelegram.Bot.Interface.Stickers.Requests; + +/// +/// Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. +/// Returns True on success. +/// +public class RemoveChatVerification : BaseValidation +{ + /// + /// Unique identifier for the target chat or username of the target channel (in the format @channelusername) + /// + public ChatId ChatId { get; set; } + + protected override IValidationResult Validate() => this.CreateValidation(); +} diff --git a/src/RxTelegram.Bot/Interface/Stickers/Requests/RemoveUserVerification.cs b/src/RxTelegram.Bot/Interface/Stickers/Requests/RemoveUserVerification.cs new file mode 100644 index 0000000..9019cfa --- /dev/null +++ b/src/RxTelegram.Bot/Interface/Stickers/Requests/RemoveUserVerification.cs @@ -0,0 +1,18 @@ +using RxTelegram.Bot.Interface.Validation; +using RxTelegram.Bot.Validation; + +namespace RxTelegram.Bot.Interface.Stickers.Requests; + +/// +/// Removes verification from a user who is currently verified on behalf of the organization represented by the bot. +/// Returns True on success. +/// +public class RemoveUserVerification : BaseValidation +{ + /// + /// User identifier of the user to be removed + /// + public long UserId { get; set; } + + protected override IValidationResult Validate() => this.CreateValidation(); +} diff --git a/src/RxTelegram.Bot/Interface/Stickers/Requests/SendGift.cs b/src/RxTelegram.Bot/Interface/Stickers/Requests/SendGift.cs index 3012585..bd31ae8 100644 --- a/src/RxTelegram.Bot/Interface/Stickers/Requests/SendGift.cs +++ b/src/RxTelegram.Bot/Interface/Stickers/Requests/SendGift.cs @@ -20,6 +20,11 @@ public class SendGift : BaseValidation /// public string GiftId { get; set; } + /// + /// Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver + /// + public bool PayForUpgrade { get; set; } + /// /// Text that will be shown along with the gift; 0-255 characters /// diff --git a/src/RxTelegram.Bot/Interface/Stickers/Requests/VerifyChat.cs b/src/RxTelegram.Bot/Interface/Stickers/Requests/VerifyChat.cs new file mode 100644 index 0000000..cb2d0dd --- /dev/null +++ b/src/RxTelegram.Bot/Interface/Stickers/Requests/VerifyChat.cs @@ -0,0 +1,24 @@ +using RxTelegram.Bot.Interface.BaseTypes; +using RxTelegram.Bot.Interface.Validation; +using RxTelegram.Bot.Validation; + +namespace RxTelegram.Bot.Interface.Stickers.Requests; + +/// +/// Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success. +/// +public class VerifyChat : BaseValidation +{ + /// + /// Unique identifier for the target chat or username of the target channel (in the format @channelusername) + /// + public ChatId ChatId { get; set; } + + /// + /// Custom description for the verification; 0-70 characters. + /// Must be empty if the organization isn't allowed to provide a custom verification description. + /// + public string CustomDescription { get; set; } + + protected override IValidationResult Validate() => this.CreateValidation(); +} diff --git a/src/RxTelegram.Bot/Interface/Stickers/Requests/VerifyUser.cs b/src/RxTelegram.Bot/Interface/Stickers/Requests/VerifyUser.cs new file mode 100644 index 0000000..936db7d --- /dev/null +++ b/src/RxTelegram.Bot/Interface/Stickers/Requests/VerifyUser.cs @@ -0,0 +1,23 @@ +using RxTelegram.Bot.Interface.Validation; +using RxTelegram.Bot.Validation; + +namespace RxTelegram.Bot.Interface.Stickers.Requests; + +/// +/// Verifies a user on behalf of the organization which is represented by the bot. Returns True on success. +/// +public class VerifyUser : BaseValidation +{ + /// + /// User identifier of the user to be verified + /// + public long UserId { get; set; } + + /// + /// Custom description for the verification; 0-70 characters. + /// Must be empty if the organization isn't allowed to provide a custom verification description. + /// + public string CustomDescription { 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 9e4b02e..d828cb7 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 - 8.1.0 + 8.2.0 icon.png true bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/RxTelegram.Bot/TelegramBot.cs b/src/RxTelegram.Bot/TelegramBot.cs index ebeb68d..7a8c1e5 100644 --- a/src/RxTelegram.Bot/TelegramBot.cs +++ b/src/RxTelegram.Bot/TelegramBot.cs @@ -1432,4 +1432,42 @@ public Task GetAvailableGifts(CancellationToken cancellationToken = /// Returns True on success. public Task SendGift(SendGift sendGift, CancellationToken cancellationToken = default) => Post("sendGift", sendGift, cancellationToken); + + /// + /// Verifies a user on behalf of the organization which is represented by the bot. Returns True on success. + /// + /// The user to verify + /// Propagates notification that operations should be canceled. + /// Returns True on success. + public Task VerifyUser(VerifyUser verifyUser, CancellationToken cancellationToken = default) => + Post("verifyUser", verifyUser, cancellationToken); + + /// + /// Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success. + /// + /// The chat to verify + /// Propagates notification that operations should be canceled. + /// Returns True on success. + public Task VerifyChat(VerifyChat verifyChat, CancellationToken cancellationToken = default) => + Post("verifyChat", verifyChat, cancellationToken); + + /// + /// Removes verification from a user who is currently verified on behalf of the organization represented by the bot. + /// Returns True on success. + /// + /// The user to remove verification from + /// Propagates notification that operations should be canceled. + /// Returns True on success. + public Task RemoveUserVerification(RemoveUserVerification removeUserVerification, CancellationToken cancellationToken = default) => + Post("removeUserVerification", removeUserVerification, cancellationToken); + + /// + /// Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. + /// Returns True on success. + /// + /// The chat to remove verification from + /// Propagates notification that operations should be canceled. + /// Returns True on success. + public Task RemoveChatVerification(RemoveChatVerification removeChatVerification, CancellationToken cancellationToken = default) => + Post("removeChatVerification", removeChatVerification, cancellationToken); } diff --git a/src/RxTelegram.Bot/Validation/ValidationResultFactory.cs b/src/RxTelegram.Bot/Validation/ValidationResultFactory.cs index 6991d70..d47211d 100644 --- a/src/RxTelegram.Bot/Validation/ValidationResultFactory.cs +++ b/src/RxTelegram.Bot/Validation/ValidationResultFactory.cs @@ -684,4 +684,16 @@ public static ValidationResult CreateValidation(this public static ValidationResult CreateValidation(this SendGift value) => new ValidationResult(value) .ValidateRequired(x => x.UserId) .ValidateRequired(x => x.GiftId); + + public static ValidationResult CreateValidation(this VerifyUser value) => + new ValidationResult(value).ValidateRequired(x => x.UserId); + + public static ValidationResult CreateValidation(this VerifyChat value) => + new ValidationResult(value).ValidateRequired(x => x.ChatId); + + public static ValidationResult CreateValidation(this RemoveUserVerification value) => + new ValidationResult(value).ValidateRequired(x => x.UserId); + + public static ValidationResult CreateValidation(this RemoveChatVerification value) => + new ValidationResult(value).ValidateRequired(x => x.ChatId); }