From 261767e3ce4778584943f4e3ea8e91b3be35c337 Mon Sep 17 00:00:00 2001 From: Niklas Weimann Date: Wed, 29 May 2024 18:33:57 +0200 Subject: [PATCH 1/2] Add support for api v7.4 --- README.md | 2 +- .../BaseTypes/Enums/MessageEntityType.cs | 7 ++++++- .../InputMedia/InputMediaAnimation.cs | 5 +++++ .../BaseTypes/InputMedia/InputMediaPhoto.cs | 5 +++++ .../BaseTypes/InputMedia/InputMediaVideo.cs | 5 +++++ .../Interface/BaseTypes/Message.cs | 10 ++++++++++ .../Requests/Attachments/SendAnimation.cs | 10 ++++++++++ .../Requests/Attachments/SendAudio.cs | 5 +++++ .../Requests/Attachments/SendContact.cs | 5 +++++ .../Requests/Attachments/SendDocument.cs | 5 +++++ .../Requests/Attachments/SendLocation.cs | 5 +++++ .../Requests/Attachments/SendMediaGroup.cs | 5 +++++ .../Requests/Attachments/SendPhoto.cs | 10 ++++++++++ .../Requests/Attachments/SendPoll.cs | 5 +++++ .../Requests/Attachments/SendVenue.cs | 5 +++++ .../Requests/Attachments/SendVideo.cs | 10 ++++++++++ .../Requests/Attachments/SendVideoNote.cs | 5 +++++ .../Requests/Attachments/SendVoice.cs | 5 +++++ .../Requests/Messages/CopyMessage.cs | 7 ++++++- .../Requests/Messages/EditMessageCaption.cs | 7 ++++++- .../BaseTypes/Requests/Messages/SendDice.cs | 5 +++++ .../Requests/Messages/SendMessage.cs | 5 +++++ .../Interface/Games/Requests/SendGame.cs | 5 +++++ .../InlineQueryResultCachedGif.cs | 5 +++++ .../InlineQueryResultCachedMpeg4Gif.cs | 5 +++++ .../InlineQueryResultCachedPhoto.cs | 5 +++++ .../InlineQueryResultCachedVideo.cs | 7 ++++++- .../InlineQueryResultGif.cs | 5 +++++ .../InlineQueryResultMpeg4Gif.cs | 5 +++++ .../InlineQueryResultPhoto.cs | 7 ++++++- .../InlineQueryResultVideo.cs | 7 ++++++- .../Payments/Requests/RefundStarPayment.cs | 20 +++++++++++++++++++ .../Payments/Requests/SendInvoice.cs | 5 +++++ .../Stickers/Requests/SendSticker.cs | 5 +++++ src/RxTelegram.Bot/RxTelegram.Bot.csproj | 2 +- src/RxTelegram.Bot/TelegramBot.cs | 9 +++++++++ .../Validation/ValidationResultFactory.cs | 6 ++++-- 37 files changed, 221 insertions(+), 10 deletions(-) create mode 100644 src/RxTelegram.Bot/Interface/Payments/Requests/RefundStarPayment.cs diff --git a/README.md b/README.md index f62a250..0444900 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.3 (as at May 6, 2024). +RxTelegram.Bot supports Telegram Bot API 7.4 (as at May 28, 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/Enums/MessageEntityType.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Enums/MessageEntityType.cs index 51872a4..1874009 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Enums/MessageEntityType.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Enums/MessageEntityType.cs @@ -95,5 +95,10 @@ public enum MessageEntityType /// /// block quotation /// - Blockquote + Blockquote, + + /// + /// collapsed-by-default block quotation + /// + ExpandableBlockquote } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaAnimation.cs b/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaAnimation.cs index 45e8cdc..8e8a6ee 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaAnimation.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaAnimation.cs @@ -71,4 +71,9 @@ public InputMediaAnimation(Stream stream, string fileName = default) : base(stre /// Optional. Pass True if the photo needs to be covered with a spoiler Animation /// public bool? HasSpoiler { get; set; } + + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaPhoto.cs b/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaPhoto.cs index 1b15d73..6dacd21 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaPhoto.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaPhoto.cs @@ -34,6 +34,11 @@ public class InputMediaPhoto : BaseInputMedia /// public bool? HasSpoiler { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + public InputMediaPhoto(string fileId) : base(fileId) { } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaVideo.cs b/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaVideo.cs index a1ffbe8..1b90768 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaVideo.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/InputMedia/InputMediaVideo.cs @@ -76,4 +76,9 @@ public InputMediaVideo(Stream stream, string fileName = default) : base(stream, /// Optional. Pass True if the photo needs to be covered with a spoiler Animation /// public bool? HasSpoiler { get; set; } + + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } } diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Message.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Message.cs index 40125d8..afae18d 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Message.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Message.cs @@ -154,11 +154,21 @@ public class Message /// public LinkPreviewOptions LinkPreviewOptions { get; set; } + /// + /// Optional. Unique identifier of the message effect added to the message + /// + public string EffectId { get; set; } + /// /// Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption /// public IEnumerable CaptionEntities { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + /// /// Optional. Description is an audio file, information about the file /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAnimation.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAnimation.cs index 463e62e..b960937 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAnimation.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAnimation.cs @@ -71,6 +71,16 @@ public class SendAnimation : BaseSend, IProtectContent /// public bool? HasSpoiler { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAudio.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAudio.cs index 065fe7e..e7ff8a1 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAudio.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendAudio.cs @@ -68,6 +68,11 @@ public class SendAudio : BaseSend, IProtectContent /// public IEnumerable CaptionEntities { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendContact.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendContact.cs index 684c261..6fa048c 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendContact.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendContact.cs @@ -59,6 +59,11 @@ public class SendContact : BaseRequest, IProtectContent /// public IReplyMarkup ReplyMarkup { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendDocument.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendDocument.cs index c530aa3..a895ece 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendDocument.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendDocument.cs @@ -42,6 +42,11 @@ public class SendDocument : BaseSend, IProtectContent /// public IEnumerable CaptionEntities { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendLocation.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendLocation.cs index 163c98f..8b2ce3c 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendLocation.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendLocation.cs @@ -65,6 +65,11 @@ public class SendLocation : BaseRequest, IProtectContent /// public IReplyMarkup ReplyMarkup { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendMediaGroup.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendMediaGroup.cs index ae6a13e..446622d 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendMediaGroup.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendMediaGroup.cs @@ -33,6 +33,11 @@ public class SendMediaGroup : BaseRequest, IProtectContent /// public ReplyParameters ReplyParameters { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPhoto.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPhoto.cs index 699353b..ea36839 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPhoto.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPhoto.cs @@ -37,6 +37,16 @@ public class SendPhoto : BaseSend, IProtectContent /// public bool? HasSpoiler { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPoll.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPoll.cs index c823ddf..51bf24c 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPoll.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendPoll.cs @@ -118,6 +118,11 @@ public class SendPoll : BaseRequest, IProtectContent /// public IEnumerable ExplanationEntities { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVenue.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVenue.cs index 9c29882..37e81ab 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVenue.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVenue.cs @@ -83,6 +83,11 @@ public class SendVenue : BaseRequest, IProtectContent /// public IReplyMarkup ReplyMarkup { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideo.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideo.cs index a07eaf1..e0a1fe9 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideo.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideo.cs @@ -74,6 +74,16 @@ public class SendVideo : BaseSend, IProtectContent /// public bool? HasSpoiler { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideoNote.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideoNote.cs index 46e6266..ba56cf0 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideoNote.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVideoNote.cs @@ -49,6 +49,11 @@ public class SendVideoNote : BaseSend, IProtectContent /// public InputFile Thumbnail { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVoice.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVoice.cs index 4c9789b..ee5da9d 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVoice.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Attachments/SendVoice.cs @@ -46,6 +46,11 @@ public class SendVoice : BaseSend, IProtectContent /// public IEnumerable CaptionEntities { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/CopyMessage.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/CopyMessage.cs index cb9b831..49e37ca 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/CopyMessage.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/CopyMessage.cs @@ -49,5 +49,10 @@ public class CopyMessage : BaseSend, IProtectContent /// public bool? ProtectContent { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); -} \ No newline at end of file +} diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/EditMessageCaption.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/EditMessageCaption.cs index fbc4cfa..7c24ff0 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/EditMessageCaption.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/EditMessageCaption.cs @@ -35,5 +35,10 @@ public class EditMessageCaption : BaseTextRequest /// public IEnumerable CaptionEntities { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); -} \ No newline at end of file +} diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendDice.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendDice.cs index ee873ec..0c12c32 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendDice.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendDice.cs @@ -42,6 +42,11 @@ public class SendDice : BaseRequest, IProtectContent /// public IReplyMarkup ReplyMarkup { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendMessage.cs b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendMessage.cs index 8b33a75..b238ec0 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendMessage.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendMessage.cs @@ -34,6 +34,11 @@ public class SendMessage : BaseTextRequest, IProtectContent /// public bool? DisableNotification { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/RxTelegram.Bot/Interface/Games/Requests/SendGame.cs b/src/RxTelegram.Bot/Interface/Games/Requests/SendGame.cs index 133c760..44651ae 100644 --- a/src/RxTelegram.Bot/Interface/Games/Requests/SendGame.cs +++ b/src/RxTelegram.Bot/Interface/Games/Requests/SendGame.cs @@ -42,6 +42,11 @@ public class SendGame : BaseRequest, IProtectContent /// public InlineKeyboardMarkup Type { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedGif.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedGif.cs index 342ca66..48e2742 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedGif.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedGif.cs @@ -30,5 +30,10 @@ public class InlineQueryResultCachedGif : BaseInlineQueryResultMedia /// public ParseMode ParseMode { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedMpeg4Gif.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedMpeg4Gif.cs index 1fca0b9..229fab2 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedMpeg4Gif.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedMpeg4Gif.cs @@ -29,5 +29,10 @@ public class InlineQueryResultCachedMpeg4Gif : BaseInlineQueryResultMedia /// public ParseMode ParseMode { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedPhoto.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedPhoto.cs index a891aa5..6ab12ae 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedPhoto.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedPhoto.cs @@ -35,5 +35,10 @@ public class InlineQueryResultCachedPhoto : BaseInlineQueryResultMedia /// public ParseMode ParseMode { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedVideo.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedVideo.cs index e47b53f..6f60003 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedVideo.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultCachedVideo.cs @@ -28,5 +28,10 @@ public class InlineQueryResultCachedVideo : BaseInlineQueryResultMedia /// public ParseMode ParseMode { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); -} \ No newline at end of file +} diff --git a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultGif.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultGif.cs index 8e16345..7b6c7f6 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultGif.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultGif.cs @@ -57,5 +57,10 @@ public class InlineQueryResultGif : BaseInlineQueryResultMedia /// public ParseMode ParseMode { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultMpeg4Gif.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultMpeg4Gif.cs index 134dc31..f1aff33 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultMpeg4Gif.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultMpeg4Gif.cs @@ -54,5 +54,10 @@ public class InlineQueryResultMpeg4Gif : BaseInlineQueryResultMedia /// public ParseMode ParseMode { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); } diff --git a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultPhoto.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultPhoto.cs index 89395a8..d3d64a5 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultPhoto.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultPhoto.cs @@ -50,5 +50,10 @@ public class InlineQueryResultPhoto : BaseInlineQueryResultMedia /// public ParseMode ParseMode { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); -} \ No newline at end of file +} diff --git a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultVideo.cs b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultVideo.cs index 601351f..0fdddaa 100644 --- a/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultVideo.cs +++ b/src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultVideo.cs @@ -65,5 +65,10 @@ public class InlineQueryResultVideo : BaseInlineQueryResultMedia /// public string Description { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + public bool ShowCaptionAboveMedia { get; set; } + protected override IValidationResult Validate() => this.CreateValidation(); -} \ No newline at end of file +} diff --git a/src/RxTelegram.Bot/Interface/Payments/Requests/RefundStarPayment.cs b/src/RxTelegram.Bot/Interface/Payments/Requests/RefundStarPayment.cs new file mode 100644 index 0000000..9665be8 --- /dev/null +++ b/src/RxTelegram.Bot/Interface/Payments/Requests/RefundStarPayment.cs @@ -0,0 +1,20 @@ +using RxTelegram.Bot.Interface.BaseTypes.Requests.Base; +using RxTelegram.Bot.Interface.Validation; +using RxTelegram.Bot.Validation; + +namespace RxTelegram.Bot.Interface.Payments.Requests; + +public class RefundStarPayment : BaseValidation +{ + /// + /// Identifier of the user whose payment will be refunded + /// + public long UserId { get; set; } + + /// + /// Telegram payment identifier + /// + public string TelegramPaymentChargeId { 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 53d755b..6cefd17 100644 --- a/src/RxTelegram.Bot/Interface/Payments/Requests/SendInvoice.cs +++ b/src/RxTelegram.Bot/Interface/Payments/Requests/SendInvoice.cs @@ -173,6 +173,11 @@ public class SendInvoice : BaseValidation, IProtectContent /// public InlineKeyboardMarkup ReplyMarkup { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/Interface/Stickers/Requests/SendSticker.cs b/src/RxTelegram.Bot/Interface/Stickers/Requests/SendSticker.cs index f8f7d6a..39f2ef8 100644 --- a/src/RxTelegram.Bot/Interface/Stickers/Requests/SendSticker.cs +++ b/src/RxTelegram.Bot/Interface/Stickers/Requests/SendSticker.cs @@ -57,6 +57,11 @@ public class SendSticker : BaseValidation, IProtectContent /// public IReplyMarkup ReplyMarkup { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + public string MessageEffectId { get; set; } + /// /// Protects the contents of the sent message from forwarding and saving /// diff --git a/src/RxTelegram.Bot/RxTelegram.Bot.csproj b/src/RxTelegram.Bot/RxTelegram.Bot.csproj index 1dc2697..da9db6a 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.3.0 + 7.4.0 icon.png true bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/RxTelegram.Bot/TelegramBot.cs b/src/RxTelegram.Bot/TelegramBot.cs index b402c9b..1b8b8df 100644 --- a/src/RxTelegram.Bot/TelegramBot.cs +++ b/src/RxTelegram.Bot/TelegramBot.cs @@ -1330,4 +1330,13 @@ public Task ReplaceStickerInSet(ReplaceStickerInSet replaceStickerInSet, C /// Returns an array of on success. public Task CopyMessages(CopyMessages copyMessages, CancellationToken cancellationToken = default) => Post("copyMessages", copyMessages, cancellationToken); + + /// + /// Refunds a successful payment in Telegram Stars. + /// + /// Information about the payment + /// Propagates notification that operations should be canceled. + /// Returns True on success. + public Task RefundStarPayment(RefundStarPayment refundStarPayment, CancellationToken cancellationToken = default) => + Post("refundStarPayment", refundStarPayment, cancellationToken); } diff --git a/src/RxTelegram.Bot/Validation/ValidationResultFactory.cs b/src/RxTelegram.Bot/Validation/ValidationResultFactory.cs index 3b82627..7f82e1e 100644 --- a/src/RxTelegram.Bot/Validation/ValidationResultFactory.cs +++ b/src/RxTelegram.Bot/Validation/ValidationResultFactory.cs @@ -444,7 +444,6 @@ public static ValidationResult CreateValidation(this Delet .ValidateRequired(x => x.ChatId) .ValidateRequired(x => x.Title) .ValidateRequired(x => x.Payload) - .ValidateRequired(x => x.ProviderToken) .ValidateRequired(x => x.Currency) .ValidateRequired(x => x.Prices) .ValidateRequired(x => x.Description); @@ -527,7 +526,6 @@ public static ValidationResult CreateValidation(this CreateIn x.Description.Length >= 1 && x.Description.Length <= 255) .ValidateRequired(x => x.Payload) - .ValidateRequired(x => x.ProviderToken) .ValidateRequired(x => x.Currency) .ValidateRequired(x => x.Prices); @@ -649,4 +647,8 @@ public static ValidationResult CreateValidation(this Replac .ValidateRequired(x => x.Name) .ValidateRequired(x => x.Sticker) .ValidateRequired(x => x.OldSticker); + + public static ValidationResult CreateValidation(this RefundStarPayment value) => + new ValidationResult(value).ValidateRequired(x => x.UserId) + .ValidateRequired(x => x.TelegramPaymentChargeId); } From b26fb65fae0800f60ac8ea9cbb035410ee3b73dc Mon Sep 17 00:00:00 2001 From: Niklas Weimann Date: Wed, 29 May 2024 18:54:39 +0200 Subject: [PATCH 2/2] Change MessageIds to fix #44 --- src/RxTelegram.Bot/Interface/BaseTypes/ExternalReplyInfo.cs | 2 +- src/RxTelegram.Bot/Interface/BaseTypes/MessageOriginChannel.cs | 2 +- .../Interface/Reaction/MessageReactionCountUpdated.cs | 2 +- src/RxTelegram.Bot/Interface/Reaction/MessageReactionUpdated.cs | 2 +- .../Interface/Reaction/Requests/SetMessageReaction.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/ExternalReplyInfo.cs b/src/RxTelegram.Bot/Interface/BaseTypes/ExternalReplyInfo.cs index 943bfa0..9e63053 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/ExternalReplyInfo.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/ExternalReplyInfo.cs @@ -24,7 +24,7 @@ public class ExternalReplyInfo /// /// Optional. Unique message identifier inside the original chat. Available only if the original chat is a supergroup or a channel. /// - public long MessageId { get; set; } + public int MessageId { get; set; } /// /// Optional. Options used for link preview generation for the original message, if it is a text message diff --git a/src/RxTelegram.Bot/Interface/BaseTypes/MessageOriginChannel.cs b/src/RxTelegram.Bot/Interface/BaseTypes/MessageOriginChannel.cs index 99c0852..755bdce 100644 --- a/src/RxTelegram.Bot/Interface/BaseTypes/MessageOriginChannel.cs +++ b/src/RxTelegram.Bot/Interface/BaseTypes/MessageOriginChannel.cs @@ -26,7 +26,7 @@ public class MessageOriginChannel : MessageOrigin /// /// Unique message identifier inside the chat /// - public long MessageId { get; set; } + public int MessageId { get; set; } /// /// Optional. Signature of the original post author diff --git a/src/RxTelegram.Bot/Interface/Reaction/MessageReactionCountUpdated.cs b/src/RxTelegram.Bot/Interface/Reaction/MessageReactionCountUpdated.cs index 0b3a4e1..412c018 100644 --- a/src/RxTelegram.Bot/Interface/Reaction/MessageReactionCountUpdated.cs +++ b/src/RxTelegram.Bot/Interface/Reaction/MessageReactionCountUpdated.cs @@ -16,7 +16,7 @@ public class MessageReactionCountUpdated /// /// Unique message identifier inside the chat /// - public long MessageId { get; set; } + public int MessageId { get; set; } /// /// Date of the change in Unix timestamp format diff --git a/src/RxTelegram.Bot/Interface/Reaction/MessageReactionUpdated.cs b/src/RxTelegram.Bot/Interface/Reaction/MessageReactionUpdated.cs index eccdb9e..fb94110 100644 --- a/src/RxTelegram.Bot/Interface/Reaction/MessageReactionUpdated.cs +++ b/src/RxTelegram.Bot/Interface/Reaction/MessageReactionUpdated.cs @@ -16,7 +16,7 @@ public class MessageReactionUpdated /// /// Unique identifier of the message inside the chat /// - public long MessageId { get; set; } + public int MessageId { get; set; } /// /// Optional. The user that changed the reaction, if the user isn't anonymous diff --git a/src/RxTelegram.Bot/Interface/Reaction/Requests/SetMessageReaction.cs b/src/RxTelegram.Bot/Interface/Reaction/Requests/SetMessageReaction.cs index a6367c0..f912c7a 100644 --- a/src/RxTelegram.Bot/Interface/Reaction/Requests/SetMessageReaction.cs +++ b/src/RxTelegram.Bot/Interface/Reaction/Requests/SetMessageReaction.cs @@ -15,7 +15,7 @@ public class SetMessageReaction : BaseRequest /// /// Identifier of the target message /// - public long MessageId { get; set; } + public int MessageId { get; set; } /// /// New list of reaction types to set on the message.