From 855929cd0ee520a78cb0311f5321663056d2cb42 Mon Sep 17 00:00:00 2001 From: Quetzal Rivera Date: Tue, 28 May 2024 22:23:18 -0600 Subject: [PATCH] feat: Update to Bot API 7.4 --- README.md | 8 +- src/examples/readme.md | 2 +- .../AvailableMethods/Args/CopyMessageArgs.cs | 6 + .../Args/SendAnimationArgs.cs | 12 ++ .../AvailableMethods/Args/SendAudioArgs.cs | 6 + .../AvailableMethods/Args/SendContactArgs.cs | 6 + .../AvailableMethods/Args/SendDiceArgs.cs | 6 + .../AvailableMethods/Args/SendDocumentArgs.cs | 6 + .../AvailableMethods/Args/SendLocationArgs.cs | 6 + .../Args/SendMediaGroupArgs.cs | 6 + .../AvailableMethods/Args/SendMessageArgs.cs | 6 + .../AvailableMethods/Args/SendPhotoArgs.cs | 12 ++ .../AvailableMethods/Args/SendPollArgs.cs | 6 + .../AvailableMethods/Args/SendVenueArgs.cs | 6 + .../AvailableMethods/Args/SendVideoArgs.cs | 12 ++ .../Args/SendVideoNoteArgs.cs | 6 + .../AvailableMethods/Args/SendVoiceArgs.cs | 6 + .../AvailableMethods/copyMessage.cs | 48 +++++-- .../AvailableMethods/sendAnimation.cs | 72 +++++++++-- .../AvailableMethods/sendAudio.cs | 48 +++++-- .../AvailableMethods/sendContact.cs | 24 +++- .../AvailableMethods/sendDice.cs | 24 +++- .../AvailableMethods/sendDocument.cs | 48 +++++-- .../AvailableMethods/sendLocation.cs | 24 +++- .../AvailableMethods/sendMediaGroup.cs | 24 +++- .../AvailableMethods/sendMessage.cs | 24 +++- .../AvailableMethods/sendPhoto.cs | 72 +++++++++-- .../AvailableMethods/sendPoll.cs | 24 +++- .../AvailableMethods/sendVenue.cs | 24 +++- .../AvailableMethods/sendVideo.cs | 72 +++++++++-- .../AvailableMethods/sendVideoNote.cs | 48 +++++-- .../AvailableMethods/sendVoice.cs | 48 +++++-- .../AvailableTypes/InlineKeyboardButton.cs | 4 +- .../InputMedia/InputMediaAnimation.cs | 6 + .../InputMedia/InputMediaPhoto.cs | 6 + .../InputMedia/InputMediaVideo.cs | 6 + .../AvailableTypes/KeyboardButton.cs | 2 +- .../MaybeInaccessibleMessage/Message.cs | 12 ++ .../AvailableTypes/MessageEntity.cs | 2 +- .../Games/Args/SendGameArgs.cs | 6 + src/library/Telegram.BotAPI/Games/sendGame.cs | 12 +- .../InlineQueryResultCachedGif.cs | 6 + .../InlineQueryResultCachedMpeg4Gif.cs | 6 + .../InlineQueryResultCachedPhoto.cs | 6 + .../InlineQueryResultCachedVideo.cs | 6 + .../InlineQueryResult/InlineQueryResultGif.cs | 6 + .../InlineQueryResultMpeg4Gif.cs | 6 + .../InlineQueryResultPhoto.cs | 6 + .../InlineQueryResultVideo.cs | 6 + .../InputInvoiceMessageContent.cs | 32 +++-- src/library/Telegram.BotAPI/MethodNames.cs | 1 + .../Payments/Args/CreateInvoiceLinkArgs.cs | 32 +++-- .../Payments/Args/SendInvoiceArgs.cs | 46 +++---- .../Telegram.BotAPI/Payments/Invoice.cs | 2 +- .../Payments/PreCheckoutQuery.cs | 2 +- .../Payments/SuccessfulPayment.cs | 2 +- .../Payments/createInvoiceLink.cs | 55 ++++---- .../Payments/refundStarPayment.cs | 49 +++++++ .../Telegram.BotAPI/Payments/sendInvoice.cs | 122 ++++++++++-------- src/library/Telegram.BotAPI/PropertyNames.cs | 3 + src/library/Telegram.BotAPI/README.md | 8 +- .../Stickers/Args/SendStickerArgs.cs | 6 + .../Telegram.BotAPI/Stickers/sendSticker.cs | 48 +++++-- .../Telegram.BotAPI/Telegram.BotAPI.csproj | 6 +- .../Args/EditMessageCaptionArgs.cs | 6 + .../UpdatingMessages/editMessageCaption.cs | 36 ++++-- src/tests/Telegram.BotAPI.Tests/Args.cs | 43 +++--- tools/omnisharp.json | 2 +- 68 files changed, 1007 insertions(+), 340 deletions(-) create mode 100644 src/library/Telegram.BotAPI/Payments/refundStarPayment.cs diff --git a/README.md b/README.md index d21410d..0275ead 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ | -------------------------------------------------- | -------------------------------- | [![NuGet version (Telegram.BotAPI)](https://img.shields.io/nuget/v/Telegram.BotAPI?style=flat-square&logo=nuget)](https://www.nuget.org/packages/Telegram.BotAPI/) -[![Compatible with Bot API v7.3](https://img.shields.io/badge/Bot%20API%20version-v7.3-blue?style=flat-square)](https://core.telegram.org/bots/api#march-31-2024) +[![Compatible with Bot API v7.4](https://img.shields.io/badge/Bot%20API%20version-v7.4-blue?style=flat-square)](https://core.telegram.org/bots/api#may-28-2024) -**Telegram.BotAPI** is one of the most complete libraries available to interact with the Telegram Bot API in your .NET projects. It contains all the methods and types available in the Bot API 7.3 released on May 6, 2024. +**Telegram.BotAPI** is one of the most complete libraries available to interact with the Telegram Bot API in your .NET projects. It contains all the methods and types available in the Bot API 7.4 released on May 28, 2024. [![Telegram Chat](https://img.shields.io/badge/Telegram.BotAPI%20--%20Chat-Join-blue?style=social&logo=telegram)](https://t.me/TBAPINET) @@ -12,8 +12,8 @@ ## Features -- Contains pre-defined methods for all Bot API 7.3 methods. -- Contains classes for each object type used in the Bot API 7.3. +- Contains pre-defined methods for all Bot API 7.4 methods. +- Contains classes for each object type used in the Bot API 7.4. - Sync and async methods. - Uses [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/). diff --git a/src/examples/readme.md b/src/examples/readme.md index bcdb38d..f85506c 100644 --- a/src/examples/readme.md +++ b/src/examples/readme.md @@ -1,7 +1,7 @@ # Telegram.BotAPI NET Examples [![NuGet version (Telegram.BotAPI)](https://img.shields.io/nuget/v/Telegram.BotAPI?style=flat-square&logo=nuget)](https://www.nuget.org/packages/Telegram.BotAPI/) -[![Compatible with Bot API v7.3](https://img.shields.io/badge/Bot%20API%20version-v7.3-blue?style=flat-square)](https://core.telegram.org/bots/api#march-31-2024) +[![Compatible with Bot API v7.4](https://img.shields.io/badge/Bot%20API%20version-v7.4-blue?style=flat-square)](https://core.telegram.org/bots/api#may-28-2024) ## Sample list diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/CopyMessageArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/CopyMessageArgs.cs index 095b0ed..842840e 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/CopyMessageArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/CopyMessageArgs.cs @@ -105,6 +105,12 @@ public CopyMessageArgs(string chatId, string fromChatId, int messageId) [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Sends the message silently. Users will receive a notification with no sound. /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendAnimationArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendAnimationArgs.cs index 0903e1b..1576567 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendAnimationArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendAnimationArgs.cs @@ -121,6 +121,12 @@ public SendAnimationArgs(string chatId, string animation) [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Pass True if the animation needs to be covered with a spoiler animation /// @@ -139,6 +145,12 @@ public SendAnimationArgs(string chatId, string animation) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendAudioArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendAudioArgs.cs index 4011be5..66ecc2e 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendAudioArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendAudioArgs.cs @@ -133,6 +133,12 @@ public SendAudioArgs(string chatId, string audio) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendContactArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendContactArgs.cs index af5d2a3..5f99a2f 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendContactArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendContactArgs.cs @@ -91,6 +91,12 @@ public SendContactArgs(string chatId, string phoneNumber, string firstName) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendDiceArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendDiceArgs.cs index a5ca228..22bc3ff 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendDiceArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendDiceArgs.cs @@ -65,6 +65,12 @@ public SendDiceArgs(string chatId) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendDocumentArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendDocumentArgs.cs index d8fe2f5..96ace96 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendDocumentArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendDocumentArgs.cs @@ -121,6 +121,12 @@ public SendDocumentArgs(string chatId, string document) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendLocationArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendLocationArgs.cs index 19015aa..fed5946 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendLocationArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendLocationArgs.cs @@ -103,6 +103,12 @@ public SendLocationArgs(string chatId, float latitude, float longitude) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendMediaGroupArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendMediaGroupArgs.cs index aa873c1..4323679 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendMediaGroupArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendMediaGroupArgs.cs @@ -135,6 +135,12 @@ public SendMediaGroupArgs(string chatId, IEnumerable media) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendMessageArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendMessageArgs.cs index 040f4d3..598f685 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendMessageArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendMessageArgs.cs @@ -87,6 +87,12 @@ public SendMessageArgs(string chatId, string text) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendPhotoArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendPhotoArgs.cs index fc8bbbf..a952676 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendPhotoArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendPhotoArgs.cs @@ -97,6 +97,12 @@ public SendPhotoArgs(string chatId, string photo) [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Pass True if the photo needs to be covered with a spoiler animation /// @@ -115,6 +121,12 @@ public SendPhotoArgs(string chatId, string photo) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendPollArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendPollArgs.cs index 00fb62a..ce68849 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendPollArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendPollArgs.cs @@ -151,6 +151,12 @@ public SendPollArgs(string chatId, string question, IEnumerable [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVenueArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVenueArgs.cs index 1424086..f1bbeb4 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVenueArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVenueArgs.cs @@ -123,6 +123,12 @@ public SendVenueArgs(string chatId, float latitude, float longitude, string titl [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVideoArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVideoArgs.cs index 13f1d62..438b8e4 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVideoArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVideoArgs.cs @@ -121,6 +121,12 @@ public SendVideoArgs(string chatId, string video) [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Pass True if the video needs to be covered with a spoiler animation /// @@ -145,6 +151,12 @@ public SendVideoArgs(string chatId, string video) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVideoNoteArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVideoNoteArgs.cs index d9e27da..f3b249e 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVideoNoteArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVideoNoteArgs.cs @@ -109,6 +109,12 @@ public SendVideoNoteArgs(string chatId, string videoNote) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVoiceArgs.cs b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVoiceArgs.cs index eb08c5a..66b5095 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVoiceArgs.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/Args/SendVoiceArgs.cs @@ -115,6 +115,12 @@ public SendVoiceArgs(string chatId, string voice) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/AvailableMethods/copyMessage.cs b/src/library/Telegram.BotAPI/AvailableMethods/copyMessage.cs index 4f64b06..e070f44 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/copyMessage.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/copyMessage.cs @@ -52,6 +52,7 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, C /// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept /// Mode for parsing entities in the new caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving /// Description of the message to reply to @@ -59,8 +60,8 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, C /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static MessageId CopyMessage(this ITelegramBotClient client, long chatId, long fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.CopyMessageAsync(chatId, fromChatId, messageId, messageThreadId, caption, parseMode, captionEntities, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static MessageId CopyMessage(this ITelegramBotClient client, long chatId, long fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.CopyMessageAsync(chatId, fromChatId, messageId, messageThreadId, caption, parseMode, captionEntities, showCaptionAboveMedia, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the of the sent message on success. @@ -73,6 +74,7 @@ public static MessageId CopyMessage(this ITelegramBotClient client, long chatId, /// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept /// Mode for parsing entities in the new caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving /// Description of the message to reply to @@ -81,7 +83,7 @@ public static MessageId CopyMessage(this ITelegramBotClient client, long chatId, /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task CopyMessageAsync(this ITelegramBotClient client, long chatId, long fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task CopyMessageAsync(this ITelegramBotClient client, long chatId, long fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -110,6 +112,10 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, l { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (disableNotification is not null) { args.Add(PropertyNames.DisableNotification, disableNotification); @@ -141,6 +147,7 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, l /// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept /// Mode for parsing entities in the new caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving /// Description of the message to reply to @@ -148,8 +155,8 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, l /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static MessageId CopyMessage(this ITelegramBotClient client, long chatId, string fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.CopyMessageAsync(chatId, fromChatId, messageId, messageThreadId, caption, parseMode, captionEntities, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static MessageId CopyMessage(this ITelegramBotClient client, long chatId, string fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.CopyMessageAsync(chatId, fromChatId, messageId, messageThreadId, caption, parseMode, captionEntities, showCaptionAboveMedia, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the of the sent message on success. @@ -162,6 +169,7 @@ public static MessageId CopyMessage(this ITelegramBotClient client, long chatId, /// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept /// Mode for parsing entities in the new caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving /// Description of the message to reply to @@ -170,7 +178,7 @@ public static MessageId CopyMessage(this ITelegramBotClient client, long chatId, /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task CopyMessageAsync(this ITelegramBotClient client, long chatId, string fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task CopyMessageAsync(this ITelegramBotClient client, long chatId, string fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -199,6 +207,10 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, l { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (disableNotification is not null) { args.Add(PropertyNames.DisableNotification, disableNotification); @@ -230,6 +242,7 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, l /// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept /// Mode for parsing entities in the new caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving /// Description of the message to reply to @@ -237,8 +250,8 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, l /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static MessageId CopyMessage(this ITelegramBotClient client, string chatId, long fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.CopyMessageAsync(chatId, fromChatId, messageId, messageThreadId, caption, parseMode, captionEntities, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static MessageId CopyMessage(this ITelegramBotClient client, string chatId, long fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.CopyMessageAsync(chatId, fromChatId, messageId, messageThreadId, caption, parseMode, captionEntities, showCaptionAboveMedia, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the of the sent message on success. @@ -251,6 +264,7 @@ public static MessageId CopyMessage(this ITelegramBotClient client, string chatI /// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept /// Mode for parsing entities in the new caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving /// Description of the message to reply to @@ -259,7 +273,7 @@ public static MessageId CopyMessage(this ITelegramBotClient client, string chatI /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task CopyMessageAsync(this ITelegramBotClient client, string chatId, long fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task CopyMessageAsync(this ITelegramBotClient client, string chatId, long fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -288,6 +302,10 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, s { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (disableNotification is not null) { args.Add(PropertyNames.DisableNotification, disableNotification); @@ -319,6 +337,7 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, s /// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept /// Mode for parsing entities in the new caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving /// Description of the message to reply to @@ -326,8 +345,8 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, s /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static MessageId CopyMessage(this ITelegramBotClient client, string chatId, string fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.CopyMessageAsync(chatId, fromChatId, messageId, messageThreadId, caption, parseMode, captionEntities, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static MessageId CopyMessage(this ITelegramBotClient client, string chatId, string fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.CopyMessageAsync(chatId, fromChatId, messageId, messageThreadId, caption, parseMode, captionEntities, showCaptionAboveMedia, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to copy messages of any kind. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the of the sent message on success. @@ -340,6 +359,7 @@ public static MessageId CopyMessage(this ITelegramBotClient client, string chatI /// New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept /// Mode for parsing entities in the new caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving /// Description of the message to reply to @@ -348,7 +368,7 @@ public static MessageId CopyMessage(this ITelegramBotClient client, string chatI /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task CopyMessageAsync(this ITelegramBotClient client, string chatId, string fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task CopyMessageAsync(this ITelegramBotClient client, string chatId, string fromChatId, int messageId, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -377,6 +397,10 @@ public static Task CopyMessageAsync(this ITelegramBotClient client, s { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (disableNotification is not null) { args.Add(PropertyNames.DisableNotification, disableNotification); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendAnimation.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendAnimation.cs index e8e6fc2..6385b32 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendAnimation.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendAnimation.cs @@ -56,16 +56,18 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, S /// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the animation caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the animation needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendAnimation(this ITelegramBotClient client, long chatId, InputFile animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendAnimationAsync(chatId, animation, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, hasSpoiler, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendAnimation(this ITelegramBotClient client, long chatId, InputFile animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendAnimationAsync(chatId, animation, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. @@ -82,16 +84,18 @@ public static Message SendAnimation(this ITelegramBotClient client, long chatId, /// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the animation caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the animation needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendAnimationAsync(this ITelegramBotClient client, long chatId, InputFile animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendAnimationAsync(this ITelegramBotClient client, long chatId, InputFile animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -139,6 +143,10 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, l { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -151,6 +159,10 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, l { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -178,17 +190,19 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, l /// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the animation caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the animation needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendAnimation(this ITelegramBotClient client, long chatId, string animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendAnimationAsync(chatId, animation, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, hasSpoiler, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendAnimation(this ITelegramBotClient client, long chatId, string animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendAnimationAsync(chatId, animation, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. @@ -205,9 +219,11 @@ public static Message SendAnimation(this ITelegramBotClient client, long chatId, /// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the animation caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the animation needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -215,7 +231,7 @@ public static Message SendAnimation(this ITelegramBotClient client, long chatId, /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendAnimationAsync(this ITelegramBotClient client, long chatId, string animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendAnimationAsync(this ITelegramBotClient client, long chatId, string animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -263,6 +279,10 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, l { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -275,6 +295,10 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, l { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -309,16 +333,18 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, l /// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the animation caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the animation needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendAnimation(this ITelegramBotClient client, string chatId, InputFile animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendAnimationAsync(chatId, animation, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, hasSpoiler, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendAnimation(this ITelegramBotClient client, string chatId, InputFile animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendAnimationAsync(chatId, animation, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. @@ -335,16 +361,18 @@ public static Message SendAnimation(this ITelegramBotClient client, string chatI /// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the animation caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the animation needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendAnimationAsync(this ITelegramBotClient client, string chatId, InputFile animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendAnimationAsync(this ITelegramBotClient client, string chatId, InputFile animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -392,6 +420,10 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, s { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -404,6 +436,10 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, s { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -431,17 +467,19 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, s /// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the animation caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the animation needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendAnimation(this ITelegramBotClient client, string chatId, string animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendAnimationAsync(chatId, animation, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, hasSpoiler, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendAnimation(this ITelegramBotClient client, string chatId, string animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendAnimationAsync(chatId, animation, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. @@ -458,9 +496,11 @@ public static Message SendAnimation(this ITelegramBotClient client, string chatI /// Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the animation caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the animation needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -468,7 +508,7 @@ public static Message SendAnimation(this ITelegramBotClient client, string chatI /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendAnimationAsync(this ITelegramBotClient client, string chatId, string animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendAnimationAsync(this ITelegramBotClient client, string chatId, string animation, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -516,6 +556,10 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, s { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -528,6 +572,10 @@ public static Task SendAnimationAsync(this ITelegramBotClient client, s { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendAudio.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendAudio.cs index 5c0cde6..d119e01 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendAudio.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendAudio.cs @@ -61,13 +61,14 @@ public static Task SendAudioAsync(this ITelegramBotClient client, SendA /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendAudio(this ITelegramBotClient client, long chatId, InputFile audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendAudioAsync(chatId, audio, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, performer, title, thumbnail, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendAudio(this ITelegramBotClient client, long chatId, InputFile audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendAudioAsync(chatId, audio, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, performer, title, thumbnail, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. @@ -87,13 +88,14 @@ public static Message SendAudio(this ITelegramBotClient client, long chatId, Inp /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendAudioAsync(this ITelegramBotClient client, long chatId, InputFile audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendAudioAsync(this ITelegramBotClient client, long chatId, InputFile audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -149,6 +151,10 @@ public static Task SendAudioAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -179,14 +185,15 @@ public static Task SendAudioAsync(this ITelegramBotClient client, long /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendAudio(this ITelegramBotClient client, long chatId, string audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendAudioAsync(chatId, audio, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, performer, title, thumbnail, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendAudio(this ITelegramBotClient client, long chatId, string audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendAudioAsync(chatId, audio, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, performer, title, thumbnail, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. @@ -206,6 +213,7 @@ public static Message SendAudio(this ITelegramBotClient client, long chatId, str /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -213,7 +221,7 @@ public static Message SendAudio(this ITelegramBotClient client, long chatId, str /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendAudioAsync(this ITelegramBotClient client, long chatId, string audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendAudioAsync(this ITelegramBotClient client, long chatId, string audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -269,6 +277,10 @@ public static Task SendAudioAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -306,13 +318,14 @@ public static Task SendAudioAsync(this ITelegramBotClient client, long /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendAudio(this ITelegramBotClient client, string chatId, InputFile audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendAudioAsync(chatId, audio, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, performer, title, thumbnail, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendAudio(this ITelegramBotClient client, string chatId, InputFile audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendAudioAsync(chatId, audio, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, performer, title, thumbnail, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. @@ -332,13 +345,14 @@ public static Message SendAudio(this ITelegramBotClient client, string chatId, I /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendAudioAsync(this ITelegramBotClient client, string chatId, InputFile audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendAudioAsync(this ITelegramBotClient client, string chatId, InputFile audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -394,6 +408,10 @@ public static Task SendAudioAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -424,14 +442,15 @@ public static Task SendAudioAsync(this ITelegramBotClient client, strin /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendAudio(this ITelegramBotClient client, string chatId, string audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendAudioAsync(chatId, audio, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, performer, title, thumbnail, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendAudio(this ITelegramBotClient client, string chatId, string audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendAudioAsync(chatId, audio, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, performer, title, thumbnail, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. @@ -451,6 +470,7 @@ public static Message SendAudio(this ITelegramBotClient client, string chatId, s /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -458,7 +478,7 @@ public static Message SendAudio(this ITelegramBotClient client, string chatId, s /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendAudioAsync(this ITelegramBotClient client, string chatId, string audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendAudioAsync(this ITelegramBotClient client, string chatId, string audio, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, string? performer = null, string? title = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -514,6 +534,10 @@ public static Task SendAudioAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendContact.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendContact.cs index 009d4a1..39e31b7 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendContact.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendContact.cs @@ -54,13 +54,14 @@ public static Task SendContactAsync(this ITelegramBotClient client, Sen /// Additional data about the contact in the form of a vCard, 0-2048 bytes /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendContact(this ITelegramBotClient client, long chatId, string phoneNumber, string firstName, string? businessConnectionId = null, int? messageThreadId = null, string? lastName = null, string? vcard = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendContactAsync(chatId, phoneNumber, firstName, businessConnectionId, messageThreadId, lastName, vcard, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendContact(this ITelegramBotClient client, long chatId, string phoneNumber, string firstName, string? businessConnectionId = null, int? messageThreadId = null, string? lastName = null, string? vcard = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendContactAsync(chatId, phoneNumber, firstName, businessConnectionId, messageThreadId, lastName, vcard, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send phone contacts. On success, the sent is returned. @@ -75,13 +76,14 @@ public static Message SendContact(this ITelegramBotClient client, long chatId, s /// Additional data about the contact in the form of a vCard, 0-2048 bytes /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendContactAsync(this ITelegramBotClient client, long chatId, string phoneNumber, string firstName, string? businessConnectionId = null, int? messageThreadId = null, string? lastName = null, string? vcard = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendContactAsync(this ITelegramBotClient client, long chatId, string phoneNumber, string firstName, string? businessConnectionId = null, int? messageThreadId = null, string? lastName = null, string? vcard = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -118,6 +120,10 @@ public static Task SendContactAsync(this ITelegramBotClient client, lon { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -143,13 +149,14 @@ public static Task SendContactAsync(this ITelegramBotClient client, lon /// Additional data about the contact in the form of a vCard, 0-2048 bytes /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendContact(this ITelegramBotClient client, string chatId, string phoneNumber, string firstName, string? businessConnectionId = null, int? messageThreadId = null, string? lastName = null, string? vcard = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendContactAsync(chatId, phoneNumber, firstName, businessConnectionId, messageThreadId, lastName, vcard, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendContact(this ITelegramBotClient client, string chatId, string phoneNumber, string firstName, string? businessConnectionId = null, int? messageThreadId = null, string? lastName = null, string? vcard = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendContactAsync(chatId, phoneNumber, firstName, businessConnectionId, messageThreadId, lastName, vcard, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send phone contacts. On success, the sent is returned. @@ -164,13 +171,14 @@ public static Message SendContact(this ITelegramBotClient client, string chatId, /// Additional data about the contact in the form of a vCard, 0-2048 bytes /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendContactAsync(this ITelegramBotClient client, string chatId, string phoneNumber, string firstName, string? businessConnectionId = null, int? messageThreadId = null, string? lastName = null, string? vcard = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendContactAsync(this ITelegramBotClient client, string chatId, string phoneNumber, string firstName, string? businessConnectionId = null, int? messageThreadId = null, string? lastName = null, string? vcard = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -207,6 +215,10 @@ public static Task SendContactAsync(this ITelegramBotClient client, str { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendDice.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendDice.cs index 05a50a8..c88c2bb 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendDice.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendDice.cs @@ -51,13 +51,14 @@ public static Task SendDiceAsync(this ITelegramBotClient client, SendDi /// Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendDice(this ITelegramBotClient client, long chatId, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendDiceAsync(chatId, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendDice(this ITelegramBotClient client, long chatId, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendDiceAsync(chatId, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send an animated emoji that will display a random value. On success, the sent is returned. @@ -69,13 +70,14 @@ public static Message SendDice(this ITelegramBotClient client, long chatId, stri /// Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendDiceAsync(this ITelegramBotClient client, long chatId, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendDiceAsync(this ITelegramBotClient client, long chatId, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -106,6 +108,10 @@ public static Task SendDiceAsync(this ITelegramBotClient client, long c { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -128,13 +134,14 @@ public static Task SendDiceAsync(this ITelegramBotClient client, long c /// Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendDice(this ITelegramBotClient client, string chatId, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendDiceAsync(chatId, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendDice(this ITelegramBotClient client, string chatId, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendDiceAsync(chatId, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send an animated emoji that will display a random value. On success, the sent is returned. @@ -146,13 +153,14 @@ public static Message SendDice(this ITelegramBotClient client, string chatId, st /// Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲” /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendDiceAsync(this ITelegramBotClient client, string chatId, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendDiceAsync(this ITelegramBotClient client, string chatId, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -183,6 +191,10 @@ public static Task SendDiceAsync(this ITelegramBotClient client, string { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendDocument.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendDocument.cs index f6c1fab..c7bcf74 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendDocument.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendDocument.cs @@ -56,13 +56,14 @@ public static Task SendDocumentAsync(this ITelegramBotClient client, Se /// Disables automatic server-side content type detection for files uploaded using multipart/form-data /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendDocument(this ITelegramBotClient client, long chatId, InputFile document, string? businessConnectionId = null, int? messageThreadId = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendDocumentAsync(chatId, document, businessConnectionId, messageThreadId, thumbnail, caption, parseMode, captionEntities, disableContentTypeDetection, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendDocument(this ITelegramBotClient client, long chatId, InputFile document, string? businessConnectionId = null, int? messageThreadId = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendDocumentAsync(chatId, document, businessConnectionId, messageThreadId, thumbnail, caption, parseMode, captionEntities, disableContentTypeDetection, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send general files. On success, the sent is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. @@ -79,13 +80,14 @@ public static Message SendDocument(this ITelegramBotClient client, long chatId, /// Disables automatic server-side content type detection for files uploaded using multipart/form-data /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendDocumentAsync(this ITelegramBotClient client, long chatId, InputFile document, string? businessConnectionId = null, int? messageThreadId = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendDocumentAsync(this ITelegramBotClient client, long chatId, InputFile document, string? businessConnectionId = null, int? messageThreadId = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -133,6 +135,10 @@ public static Task SendDocumentAsync(this ITelegramBotClient client, lo { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -160,14 +166,15 @@ public static Task SendDocumentAsync(this ITelegramBotClient client, lo /// Disables automatic server-side content type detection for files uploaded using multipart/form-data /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendDocument(this ITelegramBotClient client, long chatId, string document, string? businessConnectionId = null, int? messageThreadId = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendDocumentAsync(chatId, document, businessConnectionId, messageThreadId, thumbnail, caption, parseMode, captionEntities, disableContentTypeDetection, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendDocument(this ITelegramBotClient client, long chatId, string document, string? businessConnectionId = null, int? messageThreadId = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendDocumentAsync(chatId, document, businessConnectionId, messageThreadId, thumbnail, caption, parseMode, captionEntities, disableContentTypeDetection, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// Use this method to send general files. On success, the sent is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. @@ -184,6 +191,7 @@ public static Message SendDocument(this ITelegramBotClient client, long chatId, /// Disables automatic server-side content type detection for files uploaded using multipart/form-data /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -191,7 +199,7 @@ public static Message SendDocument(this ITelegramBotClient client, long chatId, /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendDocumentAsync(this ITelegramBotClient client, long chatId, string document, string? businessConnectionId = null, int? messageThreadId = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendDocumentAsync(this ITelegramBotClient client, long chatId, string document, string? businessConnectionId = null, int? messageThreadId = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -239,6 +247,10 @@ public static Task SendDocumentAsync(this ITelegramBotClient client, lo { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -273,13 +285,14 @@ public static Task SendDocumentAsync(this ITelegramBotClient client, lo /// Disables automatic server-side content type detection for files uploaded using multipart/form-data /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendDocument(this ITelegramBotClient client, string chatId, InputFile document, string? businessConnectionId = null, int? messageThreadId = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendDocumentAsync(chatId, document, businessConnectionId, messageThreadId, thumbnail, caption, parseMode, captionEntities, disableContentTypeDetection, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendDocument(this ITelegramBotClient client, string chatId, InputFile document, string? businessConnectionId = null, int? messageThreadId = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendDocumentAsync(chatId, document, businessConnectionId, messageThreadId, thumbnail, caption, parseMode, captionEntities, disableContentTypeDetection, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send general files. On success, the sent is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. @@ -296,13 +309,14 @@ public static Message SendDocument(this ITelegramBotClient client, string chatId /// Disables automatic server-side content type detection for files uploaded using multipart/form-data /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendDocumentAsync(this ITelegramBotClient client, string chatId, InputFile document, string? businessConnectionId = null, int? messageThreadId = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendDocumentAsync(this ITelegramBotClient client, string chatId, InputFile document, string? businessConnectionId = null, int? messageThreadId = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -350,6 +364,10 @@ public static Task SendDocumentAsync(this ITelegramBotClient client, st { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -377,14 +395,15 @@ public static Task SendDocumentAsync(this ITelegramBotClient client, st /// Disables automatic server-side content type detection for files uploaded using multipart/form-data /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendDocument(this ITelegramBotClient client, string chatId, string document, string? businessConnectionId = null, int? messageThreadId = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendDocumentAsync(chatId, document, businessConnectionId, messageThreadId, thumbnail, caption, parseMode, captionEntities, disableContentTypeDetection, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendDocument(this ITelegramBotClient client, string chatId, string document, string? businessConnectionId = null, int? messageThreadId = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendDocumentAsync(chatId, document, businessConnectionId, messageThreadId, thumbnail, caption, parseMode, captionEntities, disableContentTypeDetection, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// Use this method to send general files. On success, the sent is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. @@ -401,6 +420,7 @@ public static Message SendDocument(this ITelegramBotClient client, string chatId /// Disables automatic server-side content type detection for files uploaded using multipart/form-data /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -408,7 +428,7 @@ public static Message SendDocument(this ITelegramBotClient client, string chatId /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendDocumentAsync(this ITelegramBotClient client, string chatId, string document, string? businessConnectionId = null, int? messageThreadId = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendDocumentAsync(this ITelegramBotClient client, string chatId, string document, string? businessConnectionId = null, int? messageThreadId = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? disableContentTypeDetection = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -456,6 +476,10 @@ public static Task SendDocumentAsync(this ITelegramBotClient client, st { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendLocation.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendLocation.cs index adb7a4e..cb7d06a 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendLocation.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendLocation.cs @@ -56,13 +56,14 @@ public static Task SendLocationAsync(this ITelegramBotClient client, Se /// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendLocation(this ITelegramBotClient client, long chatId, float latitude, float longitude, string? businessConnectionId = null, int? messageThreadId = null, float? horizontalAccuracy = null, int? livePeriod = null, int? heading = null, int? proximityAlertRadius = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendLocationAsync(chatId, latitude, longitude, businessConnectionId, messageThreadId, horizontalAccuracy, livePeriod, heading, proximityAlertRadius, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendLocation(this ITelegramBotClient client, long chatId, float latitude, float longitude, string? businessConnectionId = null, int? messageThreadId = null, float? horizontalAccuracy = null, int? livePeriod = null, int? heading = null, int? proximityAlertRadius = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendLocationAsync(chatId, latitude, longitude, businessConnectionId, messageThreadId, horizontalAccuracy, livePeriod, heading, proximityAlertRadius, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send point on the map. On success, the sent is returned. @@ -79,13 +80,14 @@ public static Message SendLocation(this ITelegramBotClient client, long chatId, /// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendLocationAsync(this ITelegramBotClient client, long chatId, float latitude, float longitude, string? businessConnectionId = null, int? messageThreadId = null, float? horizontalAccuracy = null, int? livePeriod = null, int? heading = null, int? proximityAlertRadius = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendLocationAsync(this ITelegramBotClient client, long chatId, float latitude, float longitude, string? businessConnectionId = null, int? messageThreadId = null, float? horizontalAccuracy = null, int? livePeriod = null, int? heading = null, int? proximityAlertRadius = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -130,6 +132,10 @@ public static Task SendLocationAsync(this ITelegramBotClient client, lo { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -157,13 +163,14 @@ public static Task SendLocationAsync(this ITelegramBotClient client, lo /// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendLocation(this ITelegramBotClient client, string chatId, float latitude, float longitude, string? businessConnectionId = null, int? messageThreadId = null, float? horizontalAccuracy = null, int? livePeriod = null, int? heading = null, int? proximityAlertRadius = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendLocationAsync(chatId, latitude, longitude, businessConnectionId, messageThreadId, horizontalAccuracy, livePeriod, heading, proximityAlertRadius, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendLocation(this ITelegramBotClient client, string chatId, float latitude, float longitude, string? businessConnectionId = null, int? messageThreadId = null, float? horizontalAccuracy = null, int? livePeriod = null, int? heading = null, int? proximityAlertRadius = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendLocationAsync(chatId, latitude, longitude, businessConnectionId, messageThreadId, horizontalAccuracy, livePeriod, heading, proximityAlertRadius, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send point on the map. On success, the sent is returned. @@ -180,13 +187,14 @@ public static Message SendLocation(this ITelegramBotClient client, string chatId /// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendLocationAsync(this ITelegramBotClient client, string chatId, float latitude, float longitude, string? businessConnectionId = null, int? messageThreadId = null, float? horizontalAccuracy = null, int? livePeriod = null, int? heading = null, int? proximityAlertRadius = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendLocationAsync(this ITelegramBotClient client, string chatId, float latitude, float longitude, string? businessConnectionId = null, int? messageThreadId = null, float? horizontalAccuracy = null, int? livePeriod = null, int? heading = null, int? proximityAlertRadius = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -231,6 +239,10 @@ public static Task SendLocationAsync(this ITelegramBotClient client, st { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendMediaGroup.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendMediaGroup.cs index 447a9f0..03646c9 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendMediaGroup.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendMediaGroup.cs @@ -51,12 +51,13 @@ public static Task> SendMediaGroupAsync(this ITelegramBotCl /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Sends messages silently. Users will receive a notification with no sound. /// Protects the contents of the sent messages from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static IEnumerable SendMediaGroup(this ITelegramBotClient client, long chatId, IEnumerable media, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null) => - client.SendMediaGroupAsync(chatId, media, businessConnectionId, messageThreadId, disableNotification, protectContent, replyParameters).GetAwaiter().GetResult(); + public static IEnumerable SendMediaGroup(this ITelegramBotClient client, long chatId, IEnumerable media, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null) => + client.SendMediaGroupAsync(chatId, media, businessConnectionId, messageThreadId, disableNotification, protectContent, messageEffectId, replyParameters).GetAwaiter().GetResult(); /// /// Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned. @@ -68,12 +69,13 @@ public static IEnumerable SendMediaGroup(this ITelegramBotClient client /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Sends messages silently. Users will receive a notification with no sound. /// Protects the contents of the sent messages from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task> SendMediaGroupAsync(this ITelegramBotClient client, long chatId, IEnumerable media, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, CancellationToken cancellationToken = default) + public static Task> SendMediaGroupAsync(this ITelegramBotClient client, long chatId, IEnumerable media, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -101,6 +103,10 @@ public static Task> SendMediaGroupAsync(this ITelegramBotCl { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -119,12 +125,13 @@ public static Task> SendMediaGroupAsync(this ITelegramBotCl /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Sends messages silently. Users will receive a notification with no sound. /// Protects the contents of the sent messages from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static IEnumerable SendMediaGroup(this ITelegramBotClient client, string chatId, IEnumerable media, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null) => - client.SendMediaGroupAsync(chatId, media, businessConnectionId, messageThreadId, disableNotification, protectContent, replyParameters).GetAwaiter().GetResult(); + public static IEnumerable SendMediaGroup(this ITelegramBotClient client, string chatId, IEnumerable media, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null) => + client.SendMediaGroupAsync(chatId, media, businessConnectionId, messageThreadId, disableNotification, protectContent, messageEffectId, replyParameters).GetAwaiter().GetResult(); /// /// Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned. @@ -136,12 +143,13 @@ public static IEnumerable SendMediaGroup(this ITelegramBotClient client /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Sends messages silently. Users will receive a notification with no sound. /// Protects the contents of the sent messages from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task> SendMediaGroupAsync(this ITelegramBotClient client, string chatId, IEnumerable media, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, CancellationToken cancellationToken = default) + public static Task> SendMediaGroupAsync(this ITelegramBotClient client, string chatId, IEnumerable media, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -169,6 +177,10 @@ public static Task> SendMediaGroupAsync(this ITelegramBotCl { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendMessage.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendMessage.cs index af90df8..d6d60c3 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendMessage.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendMessage.cs @@ -54,13 +54,14 @@ public static Task SendMessageAsync(this ITelegramBotClient client, Sen /// Link preview generation options for the message /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendMessage(this ITelegramBotClient client, long chatId, string text, string? businessConnectionId = null, int? messageThreadId = null, string? parseMode = null, IEnumerable? entities = null, LinkPreviewOptions? linkPreviewOptions = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendMessageAsync(chatId, text, businessConnectionId, messageThreadId, parseMode, entities, linkPreviewOptions, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendMessage(this ITelegramBotClient client, long chatId, string text, string? businessConnectionId = null, int? messageThreadId = null, string? parseMode = null, IEnumerable? entities = null, LinkPreviewOptions? linkPreviewOptions = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendMessageAsync(chatId, text, businessConnectionId, messageThreadId, parseMode, entities, linkPreviewOptions, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send text messages. On success, the sent is returned. @@ -75,13 +76,14 @@ public static Message SendMessage(this ITelegramBotClient client, long chatId, s /// Link preview generation options for the message /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendMessageAsync(this ITelegramBotClient client, long chatId, string text, string? businessConnectionId = null, int? messageThreadId = null, string? parseMode = null, IEnumerable? entities = null, LinkPreviewOptions? linkPreviewOptions = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendMessageAsync(this ITelegramBotClient client, long chatId, string text, string? businessConnectionId = null, int? messageThreadId = null, string? parseMode = null, IEnumerable? entities = null, LinkPreviewOptions? linkPreviewOptions = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -121,6 +123,10 @@ public static Task SendMessageAsync(this ITelegramBotClient client, lon { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -146,13 +152,14 @@ public static Task SendMessageAsync(this ITelegramBotClient client, lon /// Link preview generation options for the message /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendMessage(this ITelegramBotClient client, string chatId, string text, string? businessConnectionId = null, int? messageThreadId = null, string? parseMode = null, IEnumerable? entities = null, LinkPreviewOptions? linkPreviewOptions = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendMessageAsync(chatId, text, businessConnectionId, messageThreadId, parseMode, entities, linkPreviewOptions, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendMessage(this ITelegramBotClient client, string chatId, string text, string? businessConnectionId = null, int? messageThreadId = null, string? parseMode = null, IEnumerable? entities = null, LinkPreviewOptions? linkPreviewOptions = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendMessageAsync(chatId, text, businessConnectionId, messageThreadId, parseMode, entities, linkPreviewOptions, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send text messages. On success, the sent is returned. @@ -167,13 +174,14 @@ public static Message SendMessage(this ITelegramBotClient client, string chatId, /// Link preview generation options for the message /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendMessageAsync(this ITelegramBotClient client, string chatId, string text, string? businessConnectionId = null, int? messageThreadId = null, string? parseMode = null, IEnumerable? entities = null, LinkPreviewOptions? linkPreviewOptions = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendMessageAsync(this ITelegramBotClient client, string chatId, string text, string? businessConnectionId = null, int? messageThreadId = null, string? parseMode = null, IEnumerable? entities = null, LinkPreviewOptions? linkPreviewOptions = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -213,6 +221,10 @@ public static Task SendMessageAsync(this ITelegramBotClient client, str { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendPhoto.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendPhoto.cs index b88a1cf..88c4f2f 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendPhoto.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendPhoto.cs @@ -52,16 +52,18 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, SendP /// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the photo caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the photo needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendPhoto(this ITelegramBotClient client, long chatId, InputFile photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendPhotoAsync(chatId, photo, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, hasSpoiler, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendPhoto(this ITelegramBotClient client, long chatId, InputFile photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendPhotoAsync(chatId, photo, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send photos. On success, the sent is returned. @@ -74,16 +76,18 @@ public static Message SendPhoto(this ITelegramBotClient client, long chatId, Inp /// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the photo caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the photo needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendPhotoAsync(this ITelegramBotClient client, long chatId, InputFile photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendPhotoAsync(this ITelegramBotClient client, long chatId, InputFile photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -115,6 +119,10 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -127,6 +135,10 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -150,16 +162,18 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, long /// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the photo caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the photo needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendPhoto(this ITelegramBotClient client, long chatId, string photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendPhotoAsync(chatId, photo, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, hasSpoiler, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendPhoto(this ITelegramBotClient client, long chatId, string photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendPhotoAsync(chatId, photo, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send photos. On success, the sent is returned. @@ -172,16 +186,18 @@ public static Message SendPhoto(this ITelegramBotClient client, long chatId, str /// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the photo caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the photo needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendPhotoAsync(this ITelegramBotClient client, long chatId, string photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendPhotoAsync(this ITelegramBotClient client, long chatId, string photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -213,6 +229,10 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -225,6 +245,10 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -248,16 +272,18 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, long /// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the photo caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the photo needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendPhoto(this ITelegramBotClient client, string chatId, InputFile photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendPhotoAsync(chatId, photo, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, hasSpoiler, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendPhoto(this ITelegramBotClient client, string chatId, InputFile photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendPhotoAsync(chatId, photo, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send photos. On success, the sent is returned. @@ -270,16 +296,18 @@ public static Message SendPhoto(this ITelegramBotClient client, string chatId, I /// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the photo caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the photo needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendPhotoAsync(this ITelegramBotClient client, string chatId, InputFile photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendPhotoAsync(this ITelegramBotClient client, string chatId, InputFile photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -311,6 +339,10 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -323,6 +355,10 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -346,16 +382,18 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, strin /// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the photo caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the photo needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendPhoto(this ITelegramBotClient client, string chatId, string photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendPhotoAsync(chatId, photo, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, hasSpoiler, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendPhoto(this ITelegramBotClient client, string chatId, string photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendPhotoAsync(chatId, photo, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send photos. On success, the sent is returned. @@ -368,16 +406,18 @@ public static Message SendPhoto(this ITelegramBotClient client, string chatId, s /// Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the photo caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the photo needs to be covered with a spoiler animation /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendPhotoAsync(this ITelegramBotClient client, string chatId, string photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendPhotoAsync(this ITelegramBotClient client, string chatId, string photo, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -409,6 +449,10 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -421,6 +465,10 @@ public static Task SendPhotoAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendPoll.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendPoll.cs index de33bbe..06a8e5b 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendPoll.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendPoll.cs @@ -64,13 +64,14 @@ public static Task SendPollAsync(this ITelegramBotClient client, SendPo /// Pass True if the poll needs to be immediately closed. This can be useful for poll preview. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendPoll(this ITelegramBotClient client, long chatId, string question, IEnumerable options, string? businessConnectionId = null, int? messageThreadId = null, string? questionParseMode = null, IEnumerable? questionEntities = null, bool? isAnonymous = null, string? type = null, bool? allowsMultipleAnswers = null, int? correctOptionId = null, string? explanation = null, string? explanationParseMode = null, IEnumerable? explanationEntities = null, int? openPeriod = null, int? closeDate = null, bool? isClosed = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendPollAsync(chatId, question, options, businessConnectionId, messageThreadId, questionParseMode, questionEntities, isAnonymous, type, allowsMultipleAnswers, correctOptionId, explanation, explanationParseMode, explanationEntities, openPeriod, closeDate, isClosed, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendPoll(this ITelegramBotClient client, long chatId, string question, IEnumerable options, string? businessConnectionId = null, int? messageThreadId = null, string? questionParseMode = null, IEnumerable? questionEntities = null, bool? isAnonymous = null, string? type = null, bool? allowsMultipleAnswers = null, int? correctOptionId = null, string? explanation = null, string? explanationParseMode = null, IEnumerable? explanationEntities = null, int? openPeriod = null, int? closeDate = null, bool? isClosed = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendPollAsync(chatId, question, options, businessConnectionId, messageThreadId, questionParseMode, questionEntities, isAnonymous, type, allowsMultipleAnswers, correctOptionId, explanation, explanationParseMode, explanationEntities, openPeriod, closeDate, isClosed, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send a native poll. On success, the sent is returned. @@ -95,13 +96,14 @@ public static Message SendPoll(this ITelegramBotClient client, long chatId, stri /// Pass True if the poll needs to be immediately closed. This can be useful for poll preview. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendPollAsync(this ITelegramBotClient client, long chatId, string question, IEnumerable options, string? businessConnectionId = null, int? messageThreadId = null, string? questionParseMode = null, IEnumerable? questionEntities = null, bool? isAnonymous = null, string? type = null, bool? allowsMultipleAnswers = null, int? correctOptionId = null, string? explanation = null, string? explanationParseMode = null, IEnumerable? explanationEntities = null, int? openPeriod = null, int? closeDate = null, bool? isClosed = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendPollAsync(this ITelegramBotClient client, long chatId, string question, IEnumerable options, string? businessConnectionId = null, int? messageThreadId = null, string? questionParseMode = null, IEnumerable? questionEntities = null, bool? isAnonymous = null, string? type = null, bool? allowsMultipleAnswers = null, int? correctOptionId = null, string? explanation = null, string? explanationParseMode = null, IEnumerable? explanationEntities = null, int? openPeriod = null, int? closeDate = null, bool? isClosed = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -178,6 +180,10 @@ public static Task SendPollAsync(this ITelegramBotClient client, long c { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -213,13 +219,14 @@ public static Task SendPollAsync(this ITelegramBotClient client, long c /// Pass True if the poll needs to be immediately closed. This can be useful for poll preview. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendPoll(this ITelegramBotClient client, string chatId, string question, IEnumerable options, string? businessConnectionId = null, int? messageThreadId = null, string? questionParseMode = null, IEnumerable? questionEntities = null, bool? isAnonymous = null, string? type = null, bool? allowsMultipleAnswers = null, int? correctOptionId = null, string? explanation = null, string? explanationParseMode = null, IEnumerable? explanationEntities = null, int? openPeriod = null, int? closeDate = null, bool? isClosed = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendPollAsync(chatId, question, options, businessConnectionId, messageThreadId, questionParseMode, questionEntities, isAnonymous, type, allowsMultipleAnswers, correctOptionId, explanation, explanationParseMode, explanationEntities, openPeriod, closeDate, isClosed, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendPoll(this ITelegramBotClient client, string chatId, string question, IEnumerable options, string? businessConnectionId = null, int? messageThreadId = null, string? questionParseMode = null, IEnumerable? questionEntities = null, bool? isAnonymous = null, string? type = null, bool? allowsMultipleAnswers = null, int? correctOptionId = null, string? explanation = null, string? explanationParseMode = null, IEnumerable? explanationEntities = null, int? openPeriod = null, int? closeDate = null, bool? isClosed = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendPollAsync(chatId, question, options, businessConnectionId, messageThreadId, questionParseMode, questionEntities, isAnonymous, type, allowsMultipleAnswers, correctOptionId, explanation, explanationParseMode, explanationEntities, openPeriod, closeDate, isClosed, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send a native poll. On success, the sent is returned. @@ -244,13 +251,14 @@ public static Message SendPoll(this ITelegramBotClient client, string chatId, st /// Pass True if the poll needs to be immediately closed. This can be useful for poll preview. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendPollAsync(this ITelegramBotClient client, string chatId, string question, IEnumerable options, string? businessConnectionId = null, int? messageThreadId = null, string? questionParseMode = null, IEnumerable? questionEntities = null, bool? isAnonymous = null, string? type = null, bool? allowsMultipleAnswers = null, int? correctOptionId = null, string? explanation = null, string? explanationParseMode = null, IEnumerable? explanationEntities = null, int? openPeriod = null, int? closeDate = null, bool? isClosed = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendPollAsync(this ITelegramBotClient client, string chatId, string question, IEnumerable options, string? businessConnectionId = null, int? messageThreadId = null, string? questionParseMode = null, IEnumerable? questionEntities = null, bool? isAnonymous = null, string? type = null, bool? allowsMultipleAnswers = null, int? correctOptionId = null, string? explanation = null, string? explanationParseMode = null, IEnumerable? explanationEntities = null, int? openPeriod = null, int? closeDate = null, bool? isClosed = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -327,6 +335,10 @@ public static Task SendPollAsync(this ITelegramBotClient client, string { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendVenue.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendVenue.cs index 7eded35..aa9148c 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendVenue.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendVenue.cs @@ -58,13 +58,14 @@ public static Task SendVenueAsync(this ITelegramBotClient client, SendV /// Google Places type of the venue. (See supported types.) /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVenue(this ITelegramBotClient client, long chatId, float latitude, float longitude, string title, string address, string? businessConnectionId = null, int? messageThreadId = null, string? foursquareId = null, string? foursquareType = null, string? googlePlaceId = null, string? googlePlaceType = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVenueAsync(chatId, latitude, longitude, title, address, businessConnectionId, messageThreadId, foursquareId, foursquareType, googlePlaceId, googlePlaceType, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVenue(this ITelegramBotClient client, long chatId, float latitude, float longitude, string title, string address, string? businessConnectionId = null, int? messageThreadId = null, string? foursquareId = null, string? foursquareType = null, string? googlePlaceId = null, string? googlePlaceType = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVenueAsync(chatId, latitude, longitude, title, address, businessConnectionId, messageThreadId, foursquareId, foursquareType, googlePlaceId, googlePlaceType, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send information about a venue. On success, the sent is returned. @@ -83,13 +84,14 @@ public static Message SendVenue(this ITelegramBotClient client, long chatId, flo /// Google Places type of the venue. (See supported types.) /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVenueAsync(this ITelegramBotClient client, long chatId, float latitude, float longitude, string title, string address, string? businessConnectionId = null, int? messageThreadId = null, string? foursquareId = null, string? foursquareType = null, string? googlePlaceId = null, string? googlePlaceType = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVenueAsync(this ITelegramBotClient client, long chatId, float latitude, float longitude, string title, string address, string? businessConnectionId = null, int? messageThreadId = null, string? foursquareId = null, string? foursquareType = null, string? googlePlaceId = null, string? googlePlaceType = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -136,6 +138,10 @@ public static Task SendVenueAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -165,13 +171,14 @@ public static Task SendVenueAsync(this ITelegramBotClient client, long /// Google Places type of the venue. (See supported types.) /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVenue(this ITelegramBotClient client, string chatId, float latitude, float longitude, string title, string address, string? businessConnectionId = null, int? messageThreadId = null, string? foursquareId = null, string? foursquareType = null, string? googlePlaceId = null, string? googlePlaceType = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVenueAsync(chatId, latitude, longitude, title, address, businessConnectionId, messageThreadId, foursquareId, foursquareType, googlePlaceId, googlePlaceType, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVenue(this ITelegramBotClient client, string chatId, float latitude, float longitude, string title, string address, string? businessConnectionId = null, int? messageThreadId = null, string? foursquareId = null, string? foursquareType = null, string? googlePlaceId = null, string? googlePlaceType = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVenueAsync(chatId, latitude, longitude, title, address, businessConnectionId, messageThreadId, foursquareId, foursquareType, googlePlaceId, googlePlaceType, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send information about a venue. On success, the sent is returned. @@ -190,13 +197,14 @@ public static Message SendVenue(this ITelegramBotClient client, string chatId, f /// Google Places type of the venue. (See supported types.) /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVenueAsync(this ITelegramBotClient client, string chatId, float latitude, float longitude, string title, string address, string? businessConnectionId = null, int? messageThreadId = null, string? foursquareId = null, string? foursquareType = null, string? googlePlaceId = null, string? googlePlaceType = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVenueAsync(this ITelegramBotClient client, string chatId, float latitude, float longitude, string title, string address, string? businessConnectionId = null, int? messageThreadId = null, string? foursquareId = null, string? foursquareType = null, string? googlePlaceId = null, string? googlePlaceType = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -243,6 +251,10 @@ public static Task SendVenueAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendVideo.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendVideo.cs index 77fd018..4ff29cc 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendVideo.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendVideo.cs @@ -56,17 +56,19 @@ public static Task SendVideoAsync(this ITelegramBotClient client, SendV /// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the video caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the video needs to be covered with a spoiler animation /// Pass True if the uploaded video is suitable for streaming /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVideo(this ITelegramBotClient client, long chatId, InputFile video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVideoAsync(chatId, video, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, hasSpoiler, supportsStreaming, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVideo(this ITelegramBotClient client, long chatId, InputFile video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVideoAsync(chatId, video, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, supportsStreaming, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as ). On success, the sent is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. @@ -83,17 +85,19 @@ public static Message SendVideo(this ITelegramBotClient client, long chatId, Inp /// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the video caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the video needs to be covered with a spoiler animation /// Pass True if the uploaded video is suitable for streaming /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVideoAsync(this ITelegramBotClient client, long chatId, InputFile video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVideoAsync(this ITelegramBotClient client, long chatId, InputFile video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -141,6 +145,10 @@ public static Task SendVideoAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -157,6 +165,10 @@ public static Task SendVideoAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -184,18 +196,20 @@ public static Task SendVideoAsync(this ITelegramBotClient client, long /// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the video caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the video needs to be covered with a spoiler animation /// Pass True if the uploaded video is suitable for streaming /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVideo(this ITelegramBotClient client, long chatId, string video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendVideoAsync(chatId, video, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, hasSpoiler, supportsStreaming, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendVideo(this ITelegramBotClient client, long chatId, string video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendVideoAsync(chatId, video, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, supportsStreaming, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as ). On success, the sent is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. @@ -212,10 +226,12 @@ public static Message SendVideo(this ITelegramBotClient client, long chatId, str /// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the video caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the video needs to be covered with a spoiler animation /// Pass True if the uploaded video is suitable for streaming /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -223,7 +239,7 @@ public static Message SendVideo(this ITelegramBotClient client, long chatId, str /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVideoAsync(this ITelegramBotClient client, long chatId, string video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendVideoAsync(this ITelegramBotClient client, long chatId, string video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -271,6 +287,10 @@ public static Task SendVideoAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -287,6 +307,10 @@ public static Task SendVideoAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -321,17 +345,19 @@ public static Task SendVideoAsync(this ITelegramBotClient client, long /// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the video caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the video needs to be covered with a spoiler animation /// Pass True if the uploaded video is suitable for streaming /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVideo(this ITelegramBotClient client, string chatId, InputFile video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVideoAsync(chatId, video, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, hasSpoiler, supportsStreaming, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVideo(this ITelegramBotClient client, string chatId, InputFile video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVideoAsync(chatId, video, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, supportsStreaming, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as ). On success, the sent is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. @@ -348,17 +374,19 @@ public static Message SendVideo(this ITelegramBotClient client, string chatId, I /// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the video caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the video needs to be covered with a spoiler animation /// Pass True if the uploaded video is suitable for streaming /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVideoAsync(this ITelegramBotClient client, string chatId, InputFile video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVideoAsync(this ITelegramBotClient client, string chatId, InputFile video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, InputFile? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -406,6 +434,10 @@ public static Task SendVideoAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -422,6 +454,10 @@ public static Task SendVideoAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -449,18 +485,20 @@ public static Task SendVideoAsync(this ITelegramBotClient client, strin /// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the video caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the video needs to be covered with a spoiler animation /// Pass True if the uploaded video is suitable for streaming /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVideo(this ITelegramBotClient client, string chatId, string video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendVideoAsync(chatId, video, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, hasSpoiler, supportsStreaming, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendVideo(this ITelegramBotClient client, string chatId, string video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendVideoAsync(chatId, video, businessConnectionId, messageThreadId, duration, width, height, thumbnail, caption, parseMode, captionEntities, showCaptionAboveMedia, hasSpoiler, supportsStreaming, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as ). On success, the sent is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. @@ -477,10 +515,12 @@ public static Message SendVideo(this ITelegramBotClient client, string chatId, s /// Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing /// Mode for parsing entities in the video caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media /// Pass True if the video needs to be covered with a spoiler animation /// Pass True if the uploaded video is suitable for streaming /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -488,7 +528,7 @@ public static Message SendVideo(this ITelegramBotClient client, string chatId, s /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVideoAsync(this ITelegramBotClient client, string chatId, string video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendVideoAsync(this ITelegramBotClient client, string chatId, string video, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? width = null, int? height = null, string? thumbnail = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, bool? hasSpoiler = null, bool? supportsStreaming = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -536,6 +576,10 @@ public static Task SendVideoAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (hasSpoiler is not null) { args.Add(PropertyNames.HasSpoiler, hasSpoiler); @@ -552,6 +596,10 @@ public static Task SendVideoAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendVideoNote.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendVideoNote.cs index 37c30da..26983cd 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendVideoNote.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendVideoNote.cs @@ -54,13 +54,14 @@ public static Task SendVideoNoteAsync(this ITelegramBotClient client, S /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVideoNote(this ITelegramBotClient client, long chatId, InputFile videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVideoNoteAsync(chatId, videoNote, businessConnectionId, messageThreadId, duration, length, thumbnail, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVideoNote(this ITelegramBotClient client, long chatId, InputFile videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVideoNoteAsync(chatId, videoNote, businessConnectionId, messageThreadId, duration, length, thumbnail, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent is returned. @@ -75,13 +76,14 @@ public static Message SendVideoNote(this ITelegramBotClient client, long chatId, /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVideoNoteAsync(this ITelegramBotClient client, long chatId, InputFile videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVideoNoteAsync(this ITelegramBotClient client, long chatId, InputFile videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -121,6 +123,10 @@ public static Task SendVideoNoteAsync(this ITelegramBotClient client, l { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -146,14 +152,15 @@ public static Task SendVideoNoteAsync(this ITelegramBotClient client, l /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVideoNote(this ITelegramBotClient client, long chatId, string videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendVideoNoteAsync(chatId, videoNote, businessConnectionId, messageThreadId, duration, length, thumbnail, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendVideoNote(this ITelegramBotClient client, long chatId, string videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendVideoNoteAsync(chatId, videoNote, businessConnectionId, messageThreadId, duration, length, thumbnail, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent is returned. @@ -168,6 +175,7 @@ public static Message SendVideoNote(this ITelegramBotClient client, long chatId, /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -175,7 +183,7 @@ public static Message SendVideoNote(this ITelegramBotClient client, long chatId, /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVideoNoteAsync(this ITelegramBotClient client, long chatId, string videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendVideoNoteAsync(this ITelegramBotClient client, long chatId, string videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -215,6 +223,10 @@ public static Task SendVideoNoteAsync(this ITelegramBotClient client, l { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -247,13 +259,14 @@ public static Task SendVideoNoteAsync(this ITelegramBotClient client, l /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVideoNote(this ITelegramBotClient client, string chatId, InputFile videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVideoNoteAsync(chatId, videoNote, businessConnectionId, messageThreadId, duration, length, thumbnail, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVideoNote(this ITelegramBotClient client, string chatId, InputFile videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVideoNoteAsync(chatId, videoNote, businessConnectionId, messageThreadId, duration, length, thumbnail, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent is returned. @@ -268,13 +281,14 @@ public static Message SendVideoNote(this ITelegramBotClient client, string chatI /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVideoNoteAsync(this ITelegramBotClient client, string chatId, InputFile videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVideoNoteAsync(this ITelegramBotClient client, string chatId, InputFile videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, InputFile? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -314,6 +328,10 @@ public static Task SendVideoNoteAsync(this ITelegramBotClient client, s { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -339,14 +357,15 @@ public static Task SendVideoNoteAsync(this ITelegramBotClient client, s /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVideoNote(this ITelegramBotClient client, string chatId, string videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => - client.SendVideoNoteAsync(chatId, videoNote, businessConnectionId, messageThreadId, duration, length, thumbnail, disableNotification, protectContent, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); + public static Message SendVideoNote(this ITelegramBotClient client, string chatId, string videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null) => + client.SendVideoNoteAsync(chatId, videoNote, businessConnectionId, messageThreadId, duration, length, thumbnail, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup, files).GetAwaiter().GetResult(); /// /// As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent is returned. @@ -361,6 +380,7 @@ public static Message SendVideoNote(this ITelegramBotClient client, string chatI /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files » /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The files to upload. @@ -368,7 +388,7 @@ public static Message SendVideoNote(this ITelegramBotClient client, string chatI /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVideoNoteAsync(this ITelegramBotClient client, string chatId, string videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) + public static Task SendVideoNoteAsync(this ITelegramBotClient client, string chatId, string videoNote, string? businessConnectionId = null, int? messageThreadId = null, int? duration = null, int? length = null, string? thumbnail = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, IDictionary? files = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -408,6 +428,10 @@ public static Task SendVideoNoteAsync(this ITelegramBotClient client, s { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableMethods/sendVoice.cs b/src/library/Telegram.BotAPI/AvailableMethods/sendVoice.cs index f896760..c575cac 100644 --- a/src/library/Telegram.BotAPI/AvailableMethods/sendVoice.cs +++ b/src/library/Telegram.BotAPI/AvailableMethods/sendVoice.cs @@ -55,13 +55,14 @@ public static Task SendVoiceAsync(this ITelegramBotClient client, SendV /// Duration of the voice message in seconds /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVoice(this ITelegramBotClient client, long chatId, InputFile voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVoiceAsync(chatId, voice, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVoice(this ITelegramBotClient client, long chatId, InputFile voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVoiceAsync(chatId, voice, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as or ). On success, the sent is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. @@ -77,13 +78,14 @@ public static Message SendVoice(this ITelegramBotClient client, long chatId, Inp /// Duration of the voice message in seconds /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVoiceAsync(this ITelegramBotClient client, long chatId, InputFile voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVoiceAsync(this ITelegramBotClient client, long chatId, InputFile voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -127,6 +129,10 @@ public static Task SendVoiceAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -153,13 +159,14 @@ public static Task SendVoiceAsync(this ITelegramBotClient client, long /// Duration of the voice message in seconds /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVoice(this ITelegramBotClient client, long chatId, string voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVoiceAsync(chatId, voice, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVoice(this ITelegramBotClient client, long chatId, string voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVoiceAsync(chatId, voice, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as or ). On success, the sent is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. @@ -175,13 +182,14 @@ public static Message SendVoice(this ITelegramBotClient client, long chatId, str /// Duration of the voice message in seconds /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVoiceAsync(this ITelegramBotClient client, long chatId, string voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVoiceAsync(this ITelegramBotClient client, long chatId, string voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -225,6 +233,10 @@ public static Task SendVoiceAsync(this ITelegramBotClient client, long { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -251,13 +263,14 @@ public static Task SendVoiceAsync(this ITelegramBotClient client, long /// Duration of the voice message in seconds /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVoice(this ITelegramBotClient client, string chatId, InputFile voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVoiceAsync(chatId, voice, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVoice(this ITelegramBotClient client, string chatId, InputFile voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVoiceAsync(chatId, voice, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as or ). On success, the sent is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. @@ -273,13 +286,14 @@ public static Message SendVoice(this ITelegramBotClient client, string chatId, I /// Duration of the voice message in seconds /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVoiceAsync(this ITelegramBotClient client, string chatId, InputFile voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVoiceAsync(this ITelegramBotClient client, string chatId, InputFile voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -323,6 +337,10 @@ public static Task SendVoiceAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -349,13 +367,14 @@ public static Task SendVoiceAsync(this ITelegramBotClient client, strin /// Duration of the voice message in seconds /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendVoice(this ITelegramBotClient client, string chatId, string voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendVoiceAsync(chatId, voice, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendVoice(this ITelegramBotClient client, string chatId, string voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendVoiceAsync(chatId, voice, businessConnectionId, messageThreadId, caption, parseMode, captionEntities, duration, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as or ). On success, the sent is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. @@ -371,13 +390,14 @@ public static Message SendVoice(this ITelegramBotClient client, string chatId, s /// Duration of the voice message in seconds /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendVoiceAsync(this ITelegramBotClient client, string chatId, string voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendVoiceAsync(this ITelegramBotClient client, string chatId, string voice, string? businessConnectionId = null, int? messageThreadId = null, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, int? duration = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -421,6 +441,10 @@ public static Task SendVoiceAsync(this ITelegramBotClient client, strin { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/AvailableTypes/InlineKeyboardButton.cs b/src/library/Telegram.BotAPI/AvailableTypes/InlineKeyboardButton.cs index e7ce480..ce2f332 100644 --- a/src/library/Telegram.BotAPI/AvailableTypes/InlineKeyboardButton.cs +++ b/src/library/Telegram.BotAPI/AvailableTypes/InlineKeyboardButton.cs @@ -7,7 +7,7 @@ namespace Telegram.BotAPI.AvailableTypes; /// -/// This object represents one button of an inline keyboard. You must use exactly one of the optional fields. +/// This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button. /// public class InlineKeyboardButton { @@ -75,7 +75,7 @@ public InlineKeyboardButton(string text) public CallbackGame? CallbackGame { get; set; } /// - /// Optional. Specify True, to send a Pay button.

NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. + /// Optional. Specify True, to send a Pay button. Substrings “⭐” and “XTR” in the buttons's text will be replaced with a Telegram Star icon.

NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. ///
[JsonPropertyName(PropertyNames.Pay)] public bool? Pay { get; set; } diff --git a/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaAnimation.cs b/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaAnimation.cs index b898acc..40dc1df 100644 --- a/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaAnimation.cs +++ b/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaAnimation.cs @@ -42,6 +42,12 @@ public InputMediaAnimation(string media) [JsonPropertyName(PropertyNames.ParseMode)] public override string? ParseMode { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Animation width /// diff --git a/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaPhoto.cs b/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaPhoto.cs index 753f654..75e30e9 100644 --- a/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaPhoto.cs +++ b/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaPhoto.cs @@ -36,6 +36,12 @@ public InputMediaPhoto(string media) [JsonPropertyName(PropertyNames.ParseMode)] public override string? ParseMode { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Pass True if the photo needs to be covered with a spoiler animation /// diff --git a/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaVideo.cs b/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaVideo.cs index 35ab2f7..7342f97 100644 --- a/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaVideo.cs +++ b/src/library/Telegram.BotAPI/AvailableTypes/InputMedia/InputMediaVideo.cs @@ -42,6 +42,12 @@ public InputMediaVideo(string media) [JsonPropertyName(PropertyNames.ParseMode)] public override string? ParseMode { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Video width /// diff --git a/src/library/Telegram.BotAPI/AvailableTypes/KeyboardButton.cs b/src/library/Telegram.BotAPI/AvailableTypes/KeyboardButton.cs index 09b89b9..353425c 100644 --- a/src/library/Telegram.BotAPI/AvailableTypes/KeyboardButton.cs +++ b/src/library/Telegram.BotAPI/AvailableTypes/KeyboardButton.cs @@ -5,7 +5,7 @@ namespace Telegram.BotAPI.AvailableTypes; /// -/// This object represents one button of the reply keyboard. For simple text buttons, String can be used instead of this object to specify the button text. The optional fields web_app, request_users, request_chat, request_contact, request_location, and request_poll are mutually exclusive. +/// This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, String can be used instead of this object to specify the button text. /// public class KeyboardButton { diff --git a/src/library/Telegram.BotAPI/AvailableTypes/MaybeInaccessibleMessage/Message.cs b/src/library/Telegram.BotAPI/AvailableTypes/MaybeInaccessibleMessage/Message.cs index bde44df..09bb08e 100644 --- a/src/library/Telegram.BotAPI/AvailableTypes/MaybeInaccessibleMessage/Message.cs +++ b/src/library/Telegram.BotAPI/AvailableTypes/MaybeInaccessibleMessage/Message.cs @@ -164,6 +164,12 @@ public class Message : MaybeInaccessibleMessage [JsonPropertyName(PropertyNames.LinkPreviewOptions)] public LinkPreviewOptions? LinkPreviewOptions { get; set; } + /// + /// Optional. Unique identifier of the message effect added to the message + /// + [JsonPropertyName(PropertyNames.EffectId)] + public string? EffectId { get; set; } + /// /// Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set /// @@ -230,6 +236,12 @@ public class Message : MaybeInaccessibleMessage [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. True, if the message media is covered by a spoiler animation /// diff --git a/src/library/Telegram.BotAPI/AvailableTypes/MessageEntity.cs b/src/library/Telegram.BotAPI/AvailableTypes/MessageEntity.cs index 6b75914..2c1c08b 100644 --- a/src/library/Telegram.BotAPI/AvailableTypes/MessageEntity.cs +++ b/src/library/Telegram.BotAPI/AvailableTypes/MessageEntity.cs @@ -10,7 +10,7 @@ namespace Telegram.BotAPI.AvailableTypes; public class MessageEntity { /// - /// Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) + /// Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) /// [JsonPropertyName(PropertyNames.Type)] public string Type { get; set; } = null!; diff --git a/src/library/Telegram.BotAPI/Games/Args/SendGameArgs.cs b/src/library/Telegram.BotAPI/Games/Args/SendGameArgs.cs index 204de1c..dceef2a 100644 --- a/src/library/Telegram.BotAPI/Games/Args/SendGameArgs.cs +++ b/src/library/Telegram.BotAPI/Games/Args/SendGameArgs.cs @@ -58,6 +58,12 @@ public SendGameArgs(long chatId, string gameShortName) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/Games/sendGame.cs b/src/library/Telegram.BotAPI/Games/sendGame.cs index 3b424cf..3c083ba 100644 --- a/src/library/Telegram.BotAPI/Games/sendGame.cs +++ b/src/library/Telegram.BotAPI/Games/sendGame.cs @@ -51,13 +51,14 @@ public static Task SendGameAsync(this ITelegramBotClient client, SendGa /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendGame(this ITelegramBotClient client, long chatId, string gameShortName, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendGameAsync(chatId, gameShortName, businessConnectionId, messageThreadId, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendGame(this ITelegramBotClient client, long chatId, string gameShortName, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendGameAsync(chatId, gameShortName, businessConnectionId, messageThreadId, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send a game. On success, the sent is returned. @@ -69,13 +70,14 @@ public static Message SendGame(this ITelegramBotClient client, long chatId, stri /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendGameAsync(this ITelegramBotClient client, long chatId, string gameShortName, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendGameAsync(this ITelegramBotClient client, long chatId, string gameShortName, string? businessConnectionId = null, int? messageThreadId = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -103,6 +105,10 @@ public static Task SendGameAsync(this ITelegramBotClient client, long c { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedGif.cs b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedGif.cs index 702ace9..348d6a6 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedGif.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedGif.cs @@ -53,6 +53,12 @@ public class InlineQueryResultCachedGif : InlineQueryResult [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Inline keyboard attached to the message /// diff --git a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedMpeg4Gif.cs b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedMpeg4Gif.cs index 3a52686..54f3db3 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedMpeg4Gif.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedMpeg4Gif.cs @@ -53,6 +53,12 @@ public class InlineQueryResultCachedMpeg4Gif : InlineQueryResult [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Inline keyboard attached to the message /// diff --git a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedPhoto.cs b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedPhoto.cs index 695c0fd..780ce41 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedPhoto.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedPhoto.cs @@ -59,6 +59,12 @@ public class InlineQueryResultCachedPhoto : InlineQueryResult [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Inline keyboard attached to the message /// diff --git a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedVideo.cs b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedVideo.cs index 3b33a16..c8d6c94 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedVideo.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultCachedVideo.cs @@ -59,6 +59,12 @@ public class InlineQueryResultCachedVideo : InlineQueryResult [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Inline keyboard attached to the message /// diff --git a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultGif.cs b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultGif.cs index fe6ce51..f691d97 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultGif.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultGif.cs @@ -83,6 +83,12 @@ public class InlineQueryResultGif : InlineQueryResult [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Inline keyboard attached to the message /// diff --git a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultMpeg4Gif.cs b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultMpeg4Gif.cs index aff8eb6..debd0f0 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultMpeg4Gif.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultMpeg4Gif.cs @@ -83,6 +83,12 @@ public class InlineQueryResultMpeg4Gif : InlineQueryResult [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Inline keyboard attached to the message /// diff --git a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultPhoto.cs b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultPhoto.cs index 3858e25..619a2cf 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultPhoto.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultPhoto.cs @@ -77,6 +77,12 @@ public class InlineQueryResultPhoto : InlineQueryResult [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Inline keyboard attached to the message /// diff --git a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultVideo.cs b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultVideo.cs index 98f6d53..5eb40ca 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultVideo.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InlineQueryResult/InlineQueryResultVideo.cs @@ -65,6 +65,12 @@ public class InlineQueryResultVideo : InlineQueryResult [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Optional. Pass True, if the caption must be shown above the message media + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// Optional. Video width /// diff --git a/src/library/Telegram.BotAPI/InlineMode/InputMessageContent/InputInvoiceMessageContent.cs b/src/library/Telegram.BotAPI/InlineMode/InputMessageContent/InputInvoiceMessageContent.cs index 355d464..f1fb7bd 100644 --- a/src/library/Telegram.BotAPI/InlineMode/InputMessageContent/InputInvoiceMessageContent.cs +++ b/src/library/Telegram.BotAPI/InlineMode/InputMessageContent/InputInvoiceMessageContent.cs @@ -17,15 +17,13 @@ public class InputInvoiceMessageContent : InputMessageContent /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via @BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - public InputInvoiceMessageContent(string title, string description, string payload, string providerToken, string currency, IEnumerable prices) + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. + public InputInvoiceMessageContent(string title, string description, string payload, string currency, IEnumerable prices) { this.Title = title ?? throw new ArgumentNullException(nameof(title)); this.Description = description ?? throw new ArgumentNullException(nameof(description)); this.Payload = payload ?? throw new ArgumentNullException(nameof(payload)); - this.ProviderToken = providerToken ?? throw new ArgumentNullException(nameof(providerToken)); this.Currency = currency ?? throw new ArgumentNullException(nameof(currency)); this.Prices = prices ?? throw new ArgumentNullException(nameof(prices)); } @@ -49,25 +47,25 @@ public InputInvoiceMessageContent(string title, string description, string paylo public string Payload { get; set; } /// - /// Payment provider token, obtained via @BotFather + /// Optional. Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.ProviderToken)] - public string ProviderToken { get; set; } + public string? ProviderToken { get; set; } /// - /// Three-letter ISO 4217 currency code, see more on currencies + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.Currency)] public string Currency { get; set; } /// - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.Prices)] public IEnumerable Prices { get; set; } /// - /// Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.MaxTipAmount)] public int? MaxTipAmount { get; set; } @@ -109,43 +107,43 @@ public InputInvoiceMessageContent(string title, string description, string paylo public int? PhotoHeight { get; set; } /// - /// Optional. Pass True if you require the user's full name to complete the order + /// Optional. Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedName)] public bool? NeedName { get; set; } /// - /// Optional. Pass True if you require the user's phone number to complete the order + /// Optional. Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedPhoneNumber)] public bool? NeedPhoneNumber { get; set; } /// - /// Optional. Pass True if you require the user's email address to complete the order + /// Optional. Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedEmail)] public bool? NeedEmail { get; set; } /// - /// Optional. Pass True if you require the user's shipping address to complete the order + /// Optional. Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedShippingAddress)] public bool? NeedShippingAddress { get; set; } /// - /// Optional. Pass True if the user's phone number should be sent to provider + /// Optional. Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.SendPhoneNumberToProvider)] public bool? SendPhoneNumberToProvider { get; set; } /// - /// Optional. Pass True if the user's email address should be sent to provider + /// Optional. Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.SendEmailToProvider)] public bool? SendEmailToProvider { get; set; } /// - /// Optional. Pass True if the final price depends on the shipping method + /// Optional. Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.IsFlexible)] public bool? IsFlexible { get; set; } diff --git a/src/library/Telegram.BotAPI/MethodNames.cs b/src/library/Telegram.BotAPI/MethodNames.cs index 4531511..98a284c 100644 --- a/src/library/Telegram.BotAPI/MethodNames.cs +++ b/src/library/Telegram.BotAPI/MethodNames.cs @@ -75,6 +75,7 @@ public static partial class MethodNames public const string LogOut = "logOut"; public const string PinChatMessage = "pinChatMessage"; public const string PromoteChatMember = "promoteChatMember"; + public const string RefundStarPayment = "refundStarPayment"; public const string ReopenForumTopic = "reopenForumTopic"; public const string ReopenGeneralForumTopic = "reopenGeneralForumTopic"; public const string ReplaceStickerInSet = "replaceStickerInSet"; diff --git a/src/library/Telegram.BotAPI/Payments/Args/CreateInvoiceLinkArgs.cs b/src/library/Telegram.BotAPI/Payments/Args/CreateInvoiceLinkArgs.cs index 76ae0f0..074d31d 100644 --- a/src/library/Telegram.BotAPI/Payments/Args/CreateInvoiceLinkArgs.cs +++ b/src/library/Telegram.BotAPI/Payments/Args/CreateInvoiceLinkArgs.cs @@ -15,15 +15,13 @@ public class CreateInvoiceLinkArgs /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - public CreateInvoiceLinkArgs(string title, string description, string payload, string providerToken, string currency, IEnumerable prices) + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. + public CreateInvoiceLinkArgs(string title, string description, string payload, string currency, IEnumerable prices) { this.Title = title ?? throw new ArgumentNullException(nameof(title)); this.Description = description ?? throw new ArgumentNullException(nameof(description)); this.Payload = payload ?? throw new ArgumentNullException(nameof(payload)); - this.ProviderToken = providerToken ?? throw new ArgumentNullException(nameof(providerToken)); this.Currency = currency ?? throw new ArgumentNullException(nameof(currency)); this.Prices = prices ?? throw new ArgumentNullException(nameof(prices)); } @@ -47,25 +45,25 @@ public CreateInvoiceLinkArgs(string title, string description, string payload, s public string Payload { get; set; } /// - /// Payment provider token, obtained via BotFather + /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.ProviderToken)] - public string ProviderToken { get; set; } + public string? ProviderToken { get; set; } /// - /// Three-letter ISO 4217 currency code, see more on currencies + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.Currency)] public string Currency { get; set; } /// - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.Prices)] public IEnumerable Prices { get; set; } /// - /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.MaxTipAmount)] public int? MaxTipAmount { get; set; } @@ -107,43 +105,43 @@ public CreateInvoiceLinkArgs(string title, string description, string payload, s public int? PhotoHeight { get; set; } /// - /// Pass True if you require the user's full name to complete the order + /// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedName)] public bool? NeedName { get; set; } /// - /// Pass True if you require the user's phone number to complete the order + /// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedPhoneNumber)] public bool? NeedPhoneNumber { get; set; } /// - /// Pass True if you require the user's email address to complete the order + /// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedEmail)] public bool? NeedEmail { get; set; } /// - /// Pass True if you require the user's shipping address to complete the order + /// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedShippingAddress)] public bool? NeedShippingAddress { get; set; } /// - /// Pass True if the user's phone number should be sent to the provider + /// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.SendPhoneNumberToProvider)] public bool? SendPhoneNumberToProvider { get; set; } /// - /// Pass True if the user's email address should be sent to the provider + /// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.SendEmailToProvider)] public bool? SendEmailToProvider { get; set; } /// - /// Pass True if the final price depends on the shipping method + /// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.IsFlexible)] public bool? IsFlexible { get; set; } diff --git a/src/library/Telegram.BotAPI/Payments/Args/SendInvoiceArgs.cs b/src/library/Telegram.BotAPI/Payments/Args/SendInvoiceArgs.cs index c5cd7fb..0872221 100644 --- a/src/library/Telegram.BotAPI/Payments/Args/SendInvoiceArgs.cs +++ b/src/library/Telegram.BotAPI/Payments/Args/SendInvoiceArgs.cs @@ -18,16 +18,14 @@ public class SendInvoiceArgs /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via @BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - public SendInvoiceArgs(long chatId, string title, string description, string payload, string providerToken, string currency, IEnumerable prices) + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. + public SendInvoiceArgs(long chatId, string title, string description, string payload, string currency, IEnumerable prices) { this.ChatId = chatId; this.Title = title ?? throw new ArgumentNullException(nameof(title)); this.Description = description ?? throw new ArgumentNullException(nameof(description)); this.Payload = payload ?? throw new ArgumentNullException(nameof(payload)); - this.ProviderToken = providerToken ?? throw new ArgumentNullException(nameof(providerToken)); this.Currency = currency ?? throw new ArgumentNullException(nameof(currency)); this.Prices = prices ?? throw new ArgumentNullException(nameof(prices)); } @@ -39,16 +37,14 @@ public SendInvoiceArgs(long chatId, string title, string description, string pay /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via @BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - public SendInvoiceArgs(string chatId, string title, string description, string payload, string providerToken, string currency, IEnumerable prices) + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. + public SendInvoiceArgs(string chatId, string title, string description, string payload, string currency, IEnumerable prices) { this.ChatId = chatId ?? throw new ArgumentNullException(nameof(chatId)); this.Title = title ?? throw new ArgumentNullException(nameof(title)); this.Description = description ?? throw new ArgumentNullException(nameof(description)); this.Payload = payload ?? throw new ArgumentNullException(nameof(payload)); - this.ProviderToken = providerToken ?? throw new ArgumentNullException(nameof(providerToken)); this.Currency = currency ?? throw new ArgumentNullException(nameof(currency)); this.Prices = prices ?? throw new ArgumentNullException(nameof(prices)); } @@ -84,25 +80,25 @@ public SendInvoiceArgs(string chatId, string title, string description, string p public string Payload { get; set; } /// - /// Payment provider token, obtained via @BotFather + /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.ProviderToken)] - public string ProviderToken { get; set; } + public string? ProviderToken { get; set; } /// - /// Three-letter ISO 4217 currency code, see more on currencies + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.Currency)] public string Currency { get; set; } /// - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.Prices)] public IEnumerable Prices { get; set; } /// - /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.MaxTipAmount)] public int? MaxTipAmount { get; set; } @@ -150,43 +146,43 @@ public SendInvoiceArgs(string chatId, string title, string description, string p public int? PhotoHeight { get; set; } /// - /// Pass True if you require the user's full name to complete the order + /// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedName)] public bool? NeedName { get; set; } /// - /// Pass True if you require the user's phone number to complete the order + /// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedPhoneNumber)] public bool? NeedPhoneNumber { get; set; } /// - /// Pass True if you require the user's email address to complete the order + /// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedEmail)] public bool? NeedEmail { get; set; } /// - /// Pass True if you require the user's shipping address to complete the order + /// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.NeedShippingAddress)] public bool? NeedShippingAddress { get; set; } /// - /// Pass True if the user's phone number should be sent to provider + /// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.SendPhoneNumberToProvider)] public bool? SendPhoneNumberToProvider { get; set; } /// - /// Pass True if the user's email address should be sent to provider + /// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.SendEmailToProvider)] public bool? SendEmailToProvider { get; set; } /// - /// Pass True if the final price depends on the shipping method + /// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// [JsonPropertyName(PropertyNames.IsFlexible)] public bool? IsFlexible { get; set; } @@ -203,6 +199,12 @@ public SendInvoiceArgs(string chatId, string title, string description, string p [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/Payments/Invoice.cs b/src/library/Telegram.BotAPI/Payments/Invoice.cs index a376416..5008f75 100644 --- a/src/library/Telegram.BotAPI/Payments/Invoice.cs +++ b/src/library/Telegram.BotAPI/Payments/Invoice.cs @@ -28,7 +28,7 @@ public class Invoice public string StartParameter { get; set; } = null!; /// - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars /// [JsonPropertyName(PropertyNames.Currency)] public string Currency { get; set; } = null!; diff --git a/src/library/Telegram.BotAPI/Payments/PreCheckoutQuery.cs b/src/library/Telegram.BotAPI/Payments/PreCheckoutQuery.cs index 713d117..5a890dc 100644 --- a/src/library/Telegram.BotAPI/Payments/PreCheckoutQuery.cs +++ b/src/library/Telegram.BotAPI/Payments/PreCheckoutQuery.cs @@ -24,7 +24,7 @@ public class PreCheckoutQuery public User From { get; set; } = null!; /// - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars /// [JsonPropertyName(PropertyNames.Currency)] public string Currency { get; set; } = null!; diff --git a/src/library/Telegram.BotAPI/Payments/SuccessfulPayment.cs b/src/library/Telegram.BotAPI/Payments/SuccessfulPayment.cs index bb641d7..c36086b 100644 --- a/src/library/Telegram.BotAPI/Payments/SuccessfulPayment.cs +++ b/src/library/Telegram.BotAPI/Payments/SuccessfulPayment.cs @@ -10,7 +10,7 @@ namespace Telegram.BotAPI.Payments; public class SuccessfulPayment { /// - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars /// [JsonPropertyName(PropertyNames.Currency)] public string Currency { get; set; } = null!; diff --git a/src/library/Telegram.BotAPI/Payments/createInvoiceLink.cs b/src/library/Telegram.BotAPI/Payments/createInvoiceLink.cs index 3e9a20e..4a47904 100644 --- a/src/library/Telegram.BotAPI/Payments/createInvoiceLink.cs +++ b/src/library/Telegram.BotAPI/Payments/createInvoiceLink.cs @@ -46,28 +46,28 @@ public static Task CreateInvoiceLinkAsync(this ITelegramBotClient client /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. + /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. + /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. /// JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. /// URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. /// Photo size in bytes /// Photo width /// Photo height - /// Pass True if you require the user's full name to complete the order - /// Pass True if you require the user's phone number to complete the order - /// Pass True if you require the user's email address to complete the order - /// Pass True if you require the user's shipping address to complete the order - /// Pass True if the user's phone number should be sent to the provider - /// Pass True if the user's email address should be sent to the provider - /// Pass True if the final price depends on the shipping method + /// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static string CreateInvoiceLink(this ITelegramBotClient client, string title, string description, string payload, string providerToken, string currency, IEnumerable prices, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null) => - client.CreateInvoiceLinkAsync(title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, providerData, photoUrl, photoSize, photoWidth, photoHeight, needName, needPhoneNumber, needEmail, needShippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible).GetAwaiter().GetResult(); + public static string CreateInvoiceLink(this ITelegramBotClient client, string title, string description, string payload, string currency, IEnumerable prices, string? providerToken = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null) => + client.CreateInvoiceLinkAsync(title, description, payload, currency, prices, providerToken, maxTipAmount, suggestedTipAmounts, providerData, photoUrl, photoSize, photoWidth, photoHeight, needName, needPhoneNumber, needEmail, needShippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible).GetAwaiter().GetResult(); /// /// Use this method to create a link for an invoice. Returns the created invoice link as String on success. @@ -76,28 +76,28 @@ public static string CreateInvoiceLink(this ITelegramBotClient client, string ti /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. + /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. + /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. /// JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. /// URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. /// Photo size in bytes /// Photo width /// Photo height - /// Pass True if you require the user's full name to complete the order - /// Pass True if you require the user's phone number to complete the order - /// Pass True if you require the user's email address to complete the order - /// Pass True if you require the user's shipping address to complete the order - /// Pass True if the user's phone number should be sent to the provider - /// Pass True if the user's email address should be sent to the provider - /// Pass True if the final price depends on the shipping method + /// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task CreateInvoiceLinkAsync(this ITelegramBotClient client, string title, string description, string payload, string providerToken, string currency, IEnumerable prices, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, CancellationToken cancellationToken = default) + public static Task CreateInvoiceLinkAsync(this ITelegramBotClient client, string title, string description, string payload, string currency, IEnumerable prices, string? providerToken = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -109,10 +109,13 @@ public static Task CreateInvoiceLinkAsync(this ITelegramBotClient client { PropertyNames.Title, title ?? throw new ArgumentNullException(nameof(title)) }, { PropertyNames.Description, description ?? throw new ArgumentNullException(nameof(description)) }, { PropertyNames.Payload, payload ?? throw new ArgumentNullException(nameof(payload)) }, - { PropertyNames.ProviderToken, providerToken ?? throw new ArgumentNullException(nameof(providerToken)) }, { PropertyNames.Currency, currency ?? throw new ArgumentNullException(nameof(currency)) }, { PropertyNames.Prices, prices ?? throw new ArgumentNullException(nameof(prices)) } }; + if (providerToken is not null) + { + args.Add(PropertyNames.ProviderToken, providerToken); + } if (maxTipAmount is not null) { args.Add(PropertyNames.MaxTipAmount, maxTipAmount); diff --git a/src/library/Telegram.BotAPI/Payments/refundStarPayment.cs b/src/library/Telegram.BotAPI/Payments/refundStarPayment.cs new file mode 100644 index 0000000..656fe2b --- /dev/null +++ b/src/library/Telegram.BotAPI/Payments/refundStarPayment.cs @@ -0,0 +1,49 @@ +// Copyright (c) 2024 Quetzal Rivera. +// Licensed under the MIT License, See LICENCE in the project root for license information. +//* This file is auto-generated. Don't edit it manually! + +namespace Telegram.BotAPI.Payments; + +/// +/// Extension methods for the Telegram Bot API. +/// +public static partial class PaymentsExtensions +{ + /// + /// Refunds a successful payment in Telegram Stars. Returns True on success. + /// + /// The instance. + /// Identifier of the user whose payment will be refunded + /// Telegram payment identifier + /// Thrown if is null. + /// Thrown if the request to the Telegram Bot API fails. + /// + public static bool RefundStarPayment(this ITelegramBotClient client, long userId, string telegramPaymentChargeId) => + client.RefundStarPaymentAsync(userId, telegramPaymentChargeId).GetAwaiter().GetResult(); + + /// + /// Refunds a successful payment in Telegram Stars. Returns True on success. + /// + /// The instance. + /// Identifier of the user whose payment will be refunded + /// Telegram payment identifier + /// The cancellation token to cancel operation. + /// Thrown if is null. + /// Thrown if the request to the Telegram Bot API fails. + /// + public static Task RefundStarPaymentAsync(this ITelegramBotClient client, long userId, string telegramPaymentChargeId, CancellationToken cancellationToken = default) + { + if (client is null) + { + throw new ArgumentNullException(nameof(client)); + } + + var args = new Dictionary() + { + { PropertyNames.UserId, userId }, + { PropertyNames.TelegramPaymentChargeId, telegramPaymentChargeId ?? throw new ArgumentNullException(nameof(telegramPaymentChargeId)) } + }; + + return client.CallMethodAsync(MethodNames.RefundStarPayment, args, cancellationToken); + } +} diff --git a/src/library/Telegram.BotAPI/Payments/sendInvoice.cs b/src/library/Telegram.BotAPI/Payments/sendInvoice.cs index a218861..34b24b0 100644 --- a/src/library/Telegram.BotAPI/Payments/sendInvoice.cs +++ b/src/library/Telegram.BotAPI/Payments/sendInvoice.cs @@ -49,11 +49,11 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, Sen /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via @BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. + /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. /// Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter /// JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. @@ -61,22 +61,23 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, Sen /// Photo size in bytes /// Photo width /// Photo height - /// Pass True if you require the user's full name to complete the order - /// Pass True if you require the user's phone number to complete the order - /// Pass True if you require the user's email address to complete the order - /// Pass True if you require the user's shipping address to complete the order - /// Pass True if the user's phone number should be sent to provider - /// Pass True if the user's email address should be sent to provider - /// Pass True if the final price depends on the shipping method + /// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendInvoice(this ITelegramBotClient client, long chatId, string title, string description, string payload, string providerToken, string currency, IEnumerable prices, int? messageThreadId = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? startParameter = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendInvoiceAsync(chatId, title, description, payload, providerToken, currency, prices, messageThreadId, maxTipAmount, suggestedTipAmounts, startParameter, providerData, photoUrl, photoSize, photoWidth, photoHeight, needName, needPhoneNumber, needEmail, needShippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendInvoice(this ITelegramBotClient client, long chatId, string title, string description, string payload, string currency, IEnumerable prices, int? messageThreadId = null, string? providerToken = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? startParameter = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendInvoiceAsync(chatId, title, description, payload, currency, prices, messageThreadId, providerToken, maxTipAmount, suggestedTipAmounts, startParameter, providerData, photoUrl, photoSize, photoWidth, photoHeight, needName, needPhoneNumber, needEmail, needShippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send invoices. On success, the sent is returned. @@ -86,11 +87,11 @@ public static Message SendInvoice(this ITelegramBotClient client, long chatId, s /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via @BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. + /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. /// Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter /// JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. @@ -98,22 +99,23 @@ public static Message SendInvoice(this ITelegramBotClient client, long chatId, s /// Photo size in bytes /// Photo width /// Photo height - /// Pass True if you require the user's full name to complete the order - /// Pass True if you require the user's phone number to complete the order - /// Pass True if you require the user's email address to complete the order - /// Pass True if you require the user's shipping address to complete the order - /// Pass True if the user's phone number should be sent to provider - /// Pass True if the user's email address should be sent to provider - /// Pass True if the final price depends on the shipping method + /// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendInvoiceAsync(this ITelegramBotClient client, long chatId, string title, string description, string payload, string providerToken, string currency, IEnumerable prices, int? messageThreadId = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? startParameter = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendInvoiceAsync(this ITelegramBotClient client, long chatId, string title, string description, string payload, string currency, IEnumerable prices, int? messageThreadId = null, string? providerToken = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? startParameter = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -126,7 +128,6 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, lon { PropertyNames.Title, title ?? throw new ArgumentNullException(nameof(title)) }, { PropertyNames.Description, description ?? throw new ArgumentNullException(nameof(description)) }, { PropertyNames.Payload, payload ?? throw new ArgumentNullException(nameof(payload)) }, - { PropertyNames.ProviderToken, providerToken ?? throw new ArgumentNullException(nameof(providerToken)) }, { PropertyNames.Currency, currency ?? throw new ArgumentNullException(nameof(currency)) }, { PropertyNames.Prices, prices ?? throw new ArgumentNullException(nameof(prices)) } }; @@ -134,6 +135,10 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, lon { args.Add(PropertyNames.MessageThreadId, messageThreadId); } + if (providerToken is not null) + { + args.Add(PropertyNames.ProviderToken, providerToken); + } if (maxTipAmount is not null) { args.Add(PropertyNames.MaxTipAmount, maxTipAmount); @@ -202,6 +207,10 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, lon { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -222,11 +231,11 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, lon /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via @BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. + /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. /// Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter /// JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. @@ -234,22 +243,23 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, lon /// Photo size in bytes /// Photo width /// Photo height - /// Pass True if you require the user's full name to complete the order - /// Pass True if you require the user's phone number to complete the order - /// Pass True if you require the user's email address to complete the order - /// Pass True if you require the user's shipping address to complete the order - /// Pass True if the user's phone number should be sent to provider - /// Pass True if the user's email address should be sent to provider - /// Pass True if the final price depends on the shipping method + /// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendInvoice(this ITelegramBotClient client, string chatId, string title, string description, string payload, string providerToken, string currency, IEnumerable prices, int? messageThreadId = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? startParameter = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendInvoiceAsync(chatId, title, description, payload, providerToken, currency, prices, messageThreadId, maxTipAmount, suggestedTipAmounts, startParameter, providerData, photoUrl, photoSize, photoWidth, photoHeight, needName, needPhoneNumber, needEmail, needShippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendInvoice(this ITelegramBotClient client, string chatId, string title, string description, string payload, string currency, IEnumerable prices, int? messageThreadId = null, string? providerToken = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? startParameter = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendInvoiceAsync(chatId, title, description, payload, currency, prices, messageThreadId, providerToken, maxTipAmount, suggestedTipAmounts, startParameter, providerData, photoUrl, photoSize, photoWidth, photoHeight, needName, needPhoneNumber, needEmail, needShippingAddress, sendPhoneNumberToProvider, sendEmailToProvider, isFlexible, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send invoices. On success, the sent is returned. @@ -259,11 +269,11 @@ public static Message SendInvoice(this ITelegramBotClient client, string chatId, /// Product name, 1-32 characters /// Product description, 1-255 characters /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - /// Payment provider token, obtained via @BotFather - /// Three-letter ISO 4217 currency code, see more on currencies - /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + /// Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars. + /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars. /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only - /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + /// Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars. + /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars. /// A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. /// Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter /// JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. @@ -271,22 +281,23 @@ public static Message SendInvoice(this ITelegramBotClient client, string chatId, /// Photo size in bytes /// Photo width /// Photo height - /// Pass True if you require the user's full name to complete the order - /// Pass True if you require the user's phone number to complete the order - /// Pass True if you require the user's email address to complete the order - /// Pass True if you require the user's shipping address to complete the order - /// Pass True if the user's phone number should be sent to provider - /// Pass True if the user's email address should be sent to provider - /// Pass True if the final price depends on the shipping method + /// Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars. + /// Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars. + /// Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars. /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button. /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendInvoiceAsync(this ITelegramBotClient client, string chatId, string title, string description, string payload, string providerToken, string currency, IEnumerable prices, int? messageThreadId = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? startParameter = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendInvoiceAsync(this ITelegramBotClient client, string chatId, string title, string description, string payload, string currency, IEnumerable prices, int? messageThreadId = null, string? providerToken = null, int? maxTipAmount = null, IEnumerable? suggestedTipAmounts = null, string? startParameter = null, string? providerData = null, string? photoUrl = null, int? photoSize = null, int? photoWidth = null, int? photoHeight = null, bool? needName = null, bool? needPhoneNumber = null, bool? needEmail = null, bool? needShippingAddress = null, bool? sendPhoneNumberToProvider = null, bool? sendEmailToProvider = null, bool? isFlexible = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -299,7 +310,6 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, str { PropertyNames.Title, title ?? throw new ArgumentNullException(nameof(title)) }, { PropertyNames.Description, description ?? throw new ArgumentNullException(nameof(description)) }, { PropertyNames.Payload, payload ?? throw new ArgumentNullException(nameof(payload)) }, - { PropertyNames.ProviderToken, providerToken ?? throw new ArgumentNullException(nameof(providerToken)) }, { PropertyNames.Currency, currency ?? throw new ArgumentNullException(nameof(currency)) }, { PropertyNames.Prices, prices ?? throw new ArgumentNullException(nameof(prices)) } }; @@ -307,6 +317,10 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, str { args.Add(PropertyNames.MessageThreadId, messageThreadId); } + if (providerToken is not null) + { + args.Add(PropertyNames.ProviderToken, providerToken); + } if (maxTipAmount is not null) { args.Add(PropertyNames.MaxTipAmount, maxTipAmount); @@ -375,6 +389,10 @@ public static Task SendInvoiceAsync(this ITelegramBotClient client, str { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/PropertyNames.cs b/src/library/Telegram.BotAPI/PropertyNames.cs index 9a44537..5923ba1 100644 --- a/src/library/Telegram.BotAPI/PropertyNames.cs +++ b/src/library/Telegram.BotAPI/PropertyNames.cs @@ -152,6 +152,7 @@ public static partial class PropertyNames public const string EditedBusinessMessage = "edited_business_message"; public const string EditedChannelPost = "edited_channel_post"; public const string EditedMessage = "edited_message"; + public const string EffectId = "effect_id"; public const string ElementHash = "element_hash"; public const string Email = "email"; public const string Emoji = "emoji"; @@ -300,6 +301,7 @@ public static partial class PropertyNames public const string Message = "message"; public const string MessageAutoDeleteTime = "message_auto_delete_time"; public const string MessageAutoDeleteTimerChanged = "message_auto_delete_timer_changed"; + public const string MessageEffectId = "message_effect_id"; public const string MessageId = "message_id"; public const string MessageIds = "message_ids"; public const string MessageReaction = "message_reaction"; @@ -445,6 +447,7 @@ public static partial class PropertyNames public const string ShortDescription = "short_description"; public const string ShowAboveText = "show_above_text"; public const string ShowAlert = "show_alert"; + public const string ShowCaptionAboveMedia = "show_caption_above_media"; public const string SlowModeDelay = "slow_mode_delay"; public const string SmallFileId = "small_file_id"; public const string SmallFileUniqueId = "small_file_unique_id"; diff --git a/src/library/Telegram.BotAPI/README.md b/src/library/Telegram.BotAPI/README.md index f415cd8..3381250 100644 --- a/src/library/Telegram.BotAPI/README.md +++ b/src/library/Telegram.BotAPI/README.md @@ -1,17 +1,17 @@ # Telegram.BotAPI -[![Compatible with Bot API v7.3](https://img.shields.io/badge/Bot%20API%20version-v7.3-blue?style=flat-square)](https://core.telegram.org/bots/api#march-31-2024) +[![Compatible with Bot API v7.4](https://img.shields.io/badge/Bot%20API%20version-v7.4-blue?style=flat-square)](https://core.telegram.org/bots/api#may-28-2024) **Telegram.BotAPI** is one of the most complete libraries available to interact with the Telegram Bot API in your .NET projects. Free and open source. -It contains all the methods and types available in the Bot API 7.3 released on May 6, 2024. +It contains all the methods and types available in the Bot API 7.4 released on May 28, 2024. --- ## Features -- Contains pre-defined methods for all Bot API 7.3 methods. -- Contains classes for each object type used in the Bot API 7.3. +- Contains pre-defined methods for all Bot API 7.4 methods. +- Contains classes for each object type used in the Bot API 7.4. - Sync and async methods. - Uses [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/). diff --git a/src/library/Telegram.BotAPI/Stickers/Args/SendStickerArgs.cs b/src/library/Telegram.BotAPI/Stickers/Args/SendStickerArgs.cs index 83a2b0c..4eb0587 100644 --- a/src/library/Telegram.BotAPI/Stickers/Args/SendStickerArgs.cs +++ b/src/library/Telegram.BotAPI/Stickers/Args/SendStickerArgs.cs @@ -97,6 +97,12 @@ public SendStickerArgs(string chatId, string sticker) [JsonPropertyName(PropertyNames.ProtectContent)] public bool? ProtectContent { get; set; } + /// + /// Unique identifier of the message effect to be added to the message; for private chats only + /// + [JsonPropertyName(PropertyNames.MessageEffectId)] + public string? MessageEffectId { get; set; } + /// /// Description of the message to reply to /// diff --git a/src/library/Telegram.BotAPI/Stickers/sendSticker.cs b/src/library/Telegram.BotAPI/Stickers/sendSticker.cs index c87cee8..da0f10f 100644 --- a/src/library/Telegram.BotAPI/Stickers/sendSticker.cs +++ b/src/library/Telegram.BotAPI/Stickers/sendSticker.cs @@ -52,13 +52,14 @@ public static Task SendStickerAsync(this ITelegramBotClient client, Sen /// Emoji associated with the sticker; only for just uploaded stickers /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendSticker(this ITelegramBotClient client, long chatId, InputFile sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendStickerAsync(chatId, sticker, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendSticker(this ITelegramBotClient client, long chatId, InputFile sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendStickerAsync(chatId, sticker, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent is returned. @@ -71,13 +72,14 @@ public static Message SendSticker(this ITelegramBotClient client, long chatId, I /// Emoji associated with the sticker; only for just uploaded stickers /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendStickerAsync(this ITelegramBotClient client, long chatId, InputFile sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendStickerAsync(this ITelegramBotClient client, long chatId, InputFile sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -109,6 +111,10 @@ public static Task SendStickerAsync(this ITelegramBotClient client, lon { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -132,13 +138,14 @@ public static Task SendStickerAsync(this ITelegramBotClient client, lon /// Emoji associated with the sticker; only for just uploaded stickers /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendSticker(this ITelegramBotClient client, long chatId, string sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendStickerAsync(chatId, sticker, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendSticker(this ITelegramBotClient client, long chatId, string sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendStickerAsync(chatId, sticker, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent is returned. @@ -151,13 +158,14 @@ public static Message SendSticker(this ITelegramBotClient client, long chatId, s /// Emoji associated with the sticker; only for just uploaded stickers /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendStickerAsync(this ITelegramBotClient client, long chatId, string sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendStickerAsync(this ITelegramBotClient client, long chatId, string sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -189,6 +197,10 @@ public static Task SendStickerAsync(this ITelegramBotClient client, lon { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -212,13 +224,14 @@ public static Task SendStickerAsync(this ITelegramBotClient client, lon /// Emoji associated with the sticker; only for just uploaded stickers /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendSticker(this ITelegramBotClient client, string chatId, InputFile sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendStickerAsync(chatId, sticker, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendSticker(this ITelegramBotClient client, string chatId, InputFile sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendStickerAsync(chatId, sticker, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent is returned. @@ -231,13 +244,14 @@ public static Message SendSticker(this ITelegramBotClient client, string chatId, /// Emoji associated with the sticker; only for just uploaded stickers /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendStickerAsync(this ITelegramBotClient client, string chatId, InputFile sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendStickerAsync(this ITelegramBotClient client, string chatId, InputFile sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -269,6 +283,10 @@ public static Task SendStickerAsync(this ITelegramBotClient client, str { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); @@ -292,13 +310,14 @@ public static Task SendStickerAsync(this ITelegramBotClient client, str /// Emoji associated with the sticker; only for just uploaded stickers /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message SendSticker(this ITelegramBotClient client, string chatId, string sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => - client.SendStickerAsync(chatId, sticker, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup).GetAwaiter().GetResult(); + public static Message SendSticker(this ITelegramBotClient client, string chatId, string sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null) => + client.SendStickerAsync(chatId, sticker, businessConnectionId, messageThreadId, emoji, disableNotification, protectContent, messageEffectId, replyParameters, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent is returned. @@ -311,13 +330,14 @@ public static Message SendSticker(this ITelegramBotClient client, string chatId, /// Emoji associated with the sticker; only for just uploaded stickers /// Sends the message silently. Users will receive a notification with no sound. /// Protects the contents of the sent message from forwarding and saving + /// Unique identifier of the message effect to be added to the message; for private chats only /// Description of the message to reply to /// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task SendStickerAsync(this ITelegramBotClient client, string chatId, string sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task SendStickerAsync(this ITelegramBotClient client, string chatId, string sticker, string? businessConnectionId = null, int? messageThreadId = null, string? emoji = null, bool? disableNotification = null, bool? protectContent = null, string? messageEffectId = null, ReplyParameters? replyParameters = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -349,6 +369,10 @@ public static Task SendStickerAsync(this ITelegramBotClient client, str { args.Add(PropertyNames.ProtectContent, protectContent); } + if (messageEffectId is not null) + { + args.Add(PropertyNames.MessageEffectId, messageEffectId); + } if (replyParameters is not null) { args.Add(PropertyNames.ReplyParameters, replyParameters); diff --git a/src/library/Telegram.BotAPI/Telegram.BotAPI.csproj b/src/library/Telegram.BotAPI/Telegram.BotAPI.csproj index 185ff71..010605f 100644 --- a/src/library/Telegram.BotAPI/Telegram.BotAPI.csproj +++ b/src/library/Telegram.BotAPI/Telegram.BotAPI.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 7.3.1 + 7.4 $(AssemblyName) Quetzal Rivera true @@ -10,7 +10,7 @@ Quetzal Rivera 2024 © en true - A very complete library to use Telegram Bot API in your NET project. Full support for Bot API v7.3 (May 6, 2024). + A very complete library to use Telegram Bot API in your NET project. Full support for Bot API v7.4 (May 28, 2024). - Contains all classes and methods available from the Bot API. Telegram;Bot;API @@ -25,7 +25,7 @@ https://github.com/Eptagone/Telegram.BotAPI Telegram.BotAPI - Add missing converters for InputMessageContent and ReplyMarkup + Updated to Bot API 7.4 true latest-recommended README.md diff --git a/src/library/Telegram.BotAPI/UpdatingMessages/Args/EditMessageCaptionArgs.cs b/src/library/Telegram.BotAPI/UpdatingMessages/Args/EditMessageCaptionArgs.cs index 4617bf7..bd800db 100644 --- a/src/library/Telegram.BotAPI/UpdatingMessages/Args/EditMessageCaptionArgs.cs +++ b/src/library/Telegram.BotAPI/UpdatingMessages/Args/EditMessageCaptionArgs.cs @@ -47,6 +47,12 @@ public class EditMessageCaptionArgs [JsonPropertyName(PropertyNames.CaptionEntities)] public IEnumerable? CaptionEntities { get; set; } + /// + /// Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages. + /// + [JsonPropertyName(PropertyNames.ShowCaptionAboveMedia)] + public bool? ShowCaptionAboveMedia { get; set; } + /// /// A JSON-serialized object for an inline keyboard. /// diff --git a/src/library/Telegram.BotAPI/UpdatingMessages/editMessageCaption.cs b/src/library/Telegram.BotAPI/UpdatingMessages/editMessageCaption.cs index 1faabfe..b2f5b51 100644 --- a/src/library/Telegram.BotAPI/UpdatingMessages/editMessageCaption.cs +++ b/src/library/Telegram.BotAPI/UpdatingMessages/editMessageCaption.cs @@ -50,12 +50,13 @@ public static Task EditMessageCaptionAsync(this ITelegramBotCl /// New caption of the message, 0-1024 characters after entities parsing /// Mode for parsing entities in the message caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages. /// A JSON-serialized object for an inline keyboard. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message EditMessageCaption(this ITelegramBotClient client, long chatId, int messageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, ReplyMarkup? replyMarkup = null) => - client.EditMessageCaptionAsync(chatId, messageId, caption, parseMode, captionEntities, replyMarkup).GetAwaiter().GetResult(); + public static Message EditMessageCaption(this ITelegramBotClient client, long chatId, int messageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, ReplyMarkup? replyMarkup = null) => + client.EditMessageCaptionAsync(chatId, messageId, caption, parseMode, captionEntities, showCaptionAboveMedia, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited is returned, otherwise True is returned. @@ -66,12 +67,13 @@ public static Message EditMessageCaption(this ITelegramBotClient client, long ch /// New caption of the message, 0-1024 characters after entities parsing /// Mode for parsing entities in the message caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages. /// A JSON-serialized object for an inline keyboard. /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task EditMessageCaptionAsync(this ITelegramBotClient client, long chatId, int messageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task EditMessageCaptionAsync(this ITelegramBotClient client, long chatId, int messageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -95,6 +97,10 @@ public static Task EditMessageCaptionAsync(this ITelegramBotClient clie { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (replyMarkup is not null) { args.Add(PropertyNames.ReplyMarkup, replyMarkup); @@ -112,12 +118,13 @@ public static Task EditMessageCaptionAsync(this ITelegramBotClient clie /// New caption of the message, 0-1024 characters after entities parsing /// Mode for parsing entities in the message caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages. /// A JSON-serialized object for an inline keyboard. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Message EditMessageCaption(this ITelegramBotClient client, string chatId, int messageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, ReplyMarkup? replyMarkup = null) => - client.EditMessageCaptionAsync(chatId, messageId, caption, parseMode, captionEntities, replyMarkup).GetAwaiter().GetResult(); + public static Message EditMessageCaption(this ITelegramBotClient client, string chatId, int messageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, ReplyMarkup? replyMarkup = null) => + client.EditMessageCaptionAsync(chatId, messageId, caption, parseMode, captionEntities, showCaptionAboveMedia, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited is returned, otherwise True is returned. @@ -128,12 +135,13 @@ public static Message EditMessageCaption(this ITelegramBotClient client, string /// New caption of the message, 0-1024 characters after entities parsing /// Mode for parsing entities in the message caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages. /// A JSON-serialized object for an inline keyboard. /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task EditMessageCaptionAsync(this ITelegramBotClient client, string chatId, int messageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task EditMessageCaptionAsync(this ITelegramBotClient client, string chatId, int messageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -157,6 +165,10 @@ public static Task EditMessageCaptionAsync(this ITelegramBotClient clie { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (replyMarkup is not null) { args.Add(PropertyNames.ReplyMarkup, replyMarkup); @@ -173,12 +185,13 @@ public static Task EditMessageCaptionAsync(this ITelegramBotClient clie /// New caption of the message, 0-1024 characters after entities parsing /// Mode for parsing entities in the message caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages. /// A JSON-serialized object for an inline keyboard. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static bool EditMessageCaption(this ITelegramBotClient client, string inlineMessageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, ReplyMarkup? replyMarkup = null) => - client.EditMessageCaptionAsync(inlineMessageId, caption, parseMode, captionEntities, replyMarkup).GetAwaiter().GetResult(); + public static bool EditMessageCaption(this ITelegramBotClient client, string inlineMessageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, ReplyMarkup? replyMarkup = null) => + client.EditMessageCaptionAsync(inlineMessageId, caption, parseMode, captionEntities, showCaptionAboveMedia, replyMarkup).GetAwaiter().GetResult(); /// /// Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited is returned, otherwise True is returned. @@ -188,12 +201,13 @@ public static bool EditMessageCaption(this ITelegramBotClient client, string inl /// New caption of the message, 0-1024 characters after entities parsing /// Mode for parsing entities in the message caption. See formatting options for more details. /// A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode + /// Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages. /// A JSON-serialized object for an inline keyboard. /// The cancellation token to cancel operation. /// Thrown if is null. /// Thrown if the request to the Telegram Bot API fails. /// - public static Task EditMessageCaptionAsync(this ITelegramBotClient client, string inlineMessageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) + public static Task EditMessageCaptionAsync(this ITelegramBotClient client, string inlineMessageId, string? caption = null, string? parseMode = null, IEnumerable? captionEntities = null, bool? showCaptionAboveMedia = null, ReplyMarkup? replyMarkup = null, CancellationToken cancellationToken = default) { if (client is null) { @@ -216,6 +230,10 @@ public static Task EditMessageCaptionAsync(this ITelegramBotClient client, { args.Add(PropertyNames.CaptionEntities, captionEntities); } + if (showCaptionAboveMedia is not null) + { + args.Add(PropertyNames.ShowCaptionAboveMedia, showCaptionAboveMedia); + } if (replyMarkup is not null) { args.Add(PropertyNames.ReplyMarkup, replyMarkup); diff --git a/src/tests/Telegram.BotAPI.Tests/Args.cs b/src/tests/Telegram.BotAPI.Tests/Args.cs index 6744434..89e8ead 100644 --- a/src/tests/Telegram.BotAPI.Tests/Args.cs +++ b/src/tests/Telegram.BotAPI.Tests/Args.cs @@ -5,28 +5,23 @@ namespace Telegram.BotAPI.Tests; public sealed class Args { - [Theory] - [InlineData(777000, "Pizza", "pepperoni, ham, cheese", "pizza", "PROVIDER TOKEN", "USD")] - [InlineData(123456789, "Burger", "ham, avocado, cheese", "burger", "PROVIDER TOKEN", "USD")] - public void SendInvoice( - long chatId, - string title, - string description, - string payload, - string providerToken, - string currency - ) - { - var prices = new LabeledPrice[] { new("Large", 499), new("Small", 199) }; - var invoiceArgs = new SendInvoiceArgs( - chatId, - title, - description, - payload, - providerToken, - currency, - prices - ); - Assert.IsType(invoiceArgs.ChatId); - } + [Theory] + [InlineData(777000, "Pizza", "pepperoni, ham, cheese", "pizza", "PROVIDER TOKEN", "USD")] + [InlineData(123456789, "Burger", "ham, avocado, cheese", "burger", "PROVIDER TOKEN", "USD")] + public void SendInvoice( + long chatId, + string title, + string description, + string payload, + string providerToken, + string currency + ) + { + var prices = new LabeledPrice[] { new("Large", 499), new("Small", 199) }; + var invoiceArgs = new SendInvoiceArgs(chatId, title, description, payload, currency, prices) + { + ProviderToken = providerToken + }; + Assert.IsType(invoiceArgs.ChatId); + } } diff --git a/tools/omnisharp.json b/tools/omnisharp.json index 945a3c2..d9ee2e8 100644 --- a/tools/omnisharp.json +++ b/tools/omnisharp.json @@ -3,4 +3,4 @@ "enableScriptNuGetReferences": true, "defaultTargetFramework": "net8.0" } -} \ No newline at end of file +}