Skip to content

Commit

Permalink
Bot API 7.10
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Sep 6, 2024
1 parent a22933b commit 9346899
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .azure-pipelines/variables.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variables:
variables:
- group: Integration Tests Variables
- name: versionPrefix
value: 21.10.1
value: 21.11.0
- name: versionSuffix
value: ''
- name: ciVersionSuffix
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# .NET Client for Telegram Bot API

[![Nuget](https://img.shields.io/badge/dynamic/json?url=https://pkgs.dev.azure.com/tgbots/Telegram.Bot/_packaging/release/nuget/v3/flat2/Telegram.Bot/index.json&query=versions%5B-1%3A%5D&style=flat-square&label=Telegram.Bot&color=d8b541)](https://dev.azure.com/tgbots/Telegram.Bot/_artifacts/feed/release/NuGet/Telegram.Bot)
[![Bot API Version](https://img.shields.io/badge/Bot_API-7.9-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api)
[![Bot API Version](https://img.shields.io/badge/Bot_API-7.10-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api)
[![Documentations](https://img.shields.io/badge/Documentations-Book-orange.svg?style=flat-square)](https://telegrambots.github.io/book/)
[![Telegram Chat](https://img.shields.io/badge/Support_Chat-Telegram-blue.svg?style=flat-square)](https://t.me/joinchat/B35YY0QbLfd034CFnvCtCA)
[![Master build](https://img.shields.io/azure-devops/build/tgbots/14f9ab3f-313a-4339-8534-e8b96c7763cc/6?style=flat-square&label=master)](https://dev.azure.com/tgbots/Telegram.Bot/_build/latest?definitionId=6&branchName=master)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ public partial class SendPaidMediaRequest : FileRequestBase<Message>, IChatTarge
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required ChatId ChatId { get; set; }

/// <summary>The number of Telegram Stars that must be paid to buy access to the media</summary>
/// <summary>The number of Telegram Stars that must be paid to buy access to the media; 1-2500</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required int StarCount { get; set; }

/// <summary>A array describing the media to be sent; up to 10 items</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required IEnumerable<InputPaidMedia> Media { get; set; }

/// <summary>Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.</summary>
public string? Payload { get; set; }

/// <summary>Media caption, 0-1024 characters after entities parsing</summary>
public string? Caption { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class CreateInvoiceLinkRequest : RequestBase<string>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required string Description { get; set; }

/// <summary>Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.</summary>
/// <summary>Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required string Payload { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Telegram.Bot/Requests/Payments/SendInvoiceRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class SendInvoiceRequest : RequestBase<Message>, IChatTargetable
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required string Description { get; set; }

/// <summary>Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.</summary>
/// <summary>Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required string Payload { get; set; }

Expand Down
9 changes: 6 additions & 3 deletions src/Telegram.Bot/TelegramBotClientExtensions.ApiMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,9 @@ public static async Task<Message> SendVideoNoteAsync(
/// <summary>Use this method to send paid media.</summary>
/// <param name="botClient">An instance of <see cref="ITelegramBotClient"/></param>
/// <param name="chatId">Unique identifier for the target chat or username of the target channel (in the format <c>@channelusername</c>). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance.</param>
/// <param name="starCount">The number of Telegram Stars that must be paid to buy access to the media</param>
/// <param name="starCount">The number of Telegram Stars that must be paid to buy access to the media; 1-2500</param>
/// <param name="media">A array describing the media to be sent; up to 10 items</param>
/// <param name="payload">Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.</param>
/// <param name="caption">Media caption, 0-1024 characters after entities parsing</param>
/// <param name="parseMode">Mode for parsing entities in the media caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.</param>
/// <param name="captionEntities">A list of special entities that appear in the caption, which can be specified instead of <paramref name="parseMode"/></param>
Expand All @@ -732,6 +733,7 @@ public static async Task<Message> SendPaidMedia(
ChatId chatId,
int starCount,
IEnumerable<InputPaidMedia> media,
string? payload = default,
string? caption = default,
ParseMode parseMode = default,
IEnumerable<MessageEntity>? captionEntities = default,
Expand All @@ -747,6 +749,7 @@ public static async Task<Message> SendPaidMedia(
ChatId = chatId,
StarCount = starCount,
Media = media,
Payload = payload,
Caption = caption,
ParseMode = parseMode,
CaptionEntities = captionEntities,
Expand Down Expand Up @@ -2946,7 +2949,7 @@ public static async Task<SentWebAppMessage> AnswerWebAppQueryAsync(
/// <param name="chatId">Unique identifier for the target chat or username of the target channel (in the format <c>@channelusername</c>)</param>
/// <param name="title">Product name, 1-32 characters</param>
/// <param name="description">Product description, 1-255 characters</param>
/// <param name="payload">Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.</param>
/// <param name="payload">Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.</param>
/// <param name="providerToken">Payment provider token, obtained via <a href="https://t.me/botfather">@BotFather</a>. Pass an empty string for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</param>
/// <param name="currency">Three-letter ISO 4217 currency code, see <a href="https://core.telegram.org/bots/payments#supported-currencies">more on currencies</a>. Pass “XTR” for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</param>
/// <param name="prices">Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</param>
Expand Down Expand Up @@ -3040,7 +3043,7 @@ public static async Task<Message> SendInvoiceAsync(
/// <param name="botClient">An instance of <see cref="ITelegramBotClient"/></param>
/// <param name="title">Product name, 1-32 characters</param>
/// <param name="description">Product description, 1-255 characters</param>
/// <param name="payload">Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.</param>
/// <param name="payload">Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.</param>
/// <param name="providerToken">Payment provider token, obtained via <a href="https://t.me/botfather">@BotFather</a>. Pass an empty string for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</param>
/// <param name="currency">Three-letter ISO 4217 currency code, see <a href="https://core.telegram.org/bots/payments#supported-currencies">more on currencies</a>. Pass “XTR” for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</param>
/// <param name="prices">Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</param>
Expand Down
7 changes: 5 additions & 2 deletions src/Telegram.Bot/Types/ChatBoostSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public partial class ChatBoostSourceGiftCode : ChatBoostSource
public User User { get; set; } = default!;
}

/// <summary>The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.</summary>
/// <summary>The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and <see cref="PrizeStarCount">PrizeStarCount</see> / 500 times for one year for Telegram Star giveaways.</summary>
public partial class ChatBoostSourceGiveaway : ChatBoostSource
{
/// <summary>Source of the boost, always <see cref="ChatBoostSourceType.Giveaway"/></summary>
Expand All @@ -44,9 +44,12 @@ public partial class ChatBoostSourceGiveaway : ChatBoostSource
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public int GiveawayMessageId { get; set; }

/// <summary><em>Optional</em>. User that won the prize in the giveaway if any</summary>
/// <summary><em>Optional</em>. User that won the prize in the giveaway if any; for Telegram Premium giveaways only</summary>
public User? User { get; set; }

/// <summary><em>Optional</em>. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only</summary>
public int? PrizeStarCount { get; set; }

/// <summary><em>Optional</em>. <see langword="true"/>, if the giveaway was completed, but there was no user to win the prize</summary>
public bool IsUnclaimed { get; set; }
}
6 changes: 6 additions & 0 deletions src/Telegram.Bot/Types/ChatInviteLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@ public partial class ChatInviteLink

/// <summary><em>Optional</em>. Number of pending join requests created using this link</summary>
public int? PendingJoinRequestCount { get; set; }

/// <summary><em>Optional</em>. The number of seconds the subscription will be active for before the next payment</summary>
public int? SubscriptionPeriod { get; set; }

/// <summary><em>Optional</em>. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat using the link</summary>
public int? SubscriptionPrice { get; set; }
}
2 changes: 1 addition & 1 deletion src/Telegram.Bot/Types/Enums/ChatBoostSourceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public enum ChatBoostSourceType
Premium = 1,
/// <summary>The boost was obtained by the creation of Telegram Premium gift codes to boost a chat. Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.<br/><br/><i>(<see cref="ChatBoostSource"/> can be cast into <see cref="ChatBoostSourceGiftCode"/>)</i></summary>
GiftCode,
/// <summary>The boost was obtained by the creation of a Telegram Premium giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.<br/><br/><i>(<see cref="ChatBoostSource"/> can be cast into <see cref="ChatBoostSourceGiveaway"/>)</i></summary>
/// <summary>The boost was obtained by the creation of a Telegram Premium or a Telegram Star giveaway. This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription for Telegram Premium giveaways and <see cref="PrizeStarCount">PrizeStarCount</see> / 500 times for one year for Telegram Star giveaways.<br/><br/><i>(<see cref="ChatBoostSource"/> can be cast into <see cref="ChatBoostSourceGiveaway"/>)</i></summary>
Giveaway,
}
2 changes: 2 additions & 0 deletions src/Telegram.Bot/Types/Enums/UpdateType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ public enum UpdateType
EditedBusinessMessage,
/// <summary>The <see cref="Update"/> contains a <see cref="Update.DeletedBusinessMessages"/></summary>
DeletedBusinessMessages,
/// <summary>The <see cref="Update"/> contains a <see cref="Update.PurchasedPaidMedia"/></summary>
PurchasedPaidMedia,
}
5 changes: 4 additions & 1 deletion src/Telegram.Bot/Types/Giveaway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public partial class Giveaway
/// <summary><em>Optional</em>. A list of two-letter <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a> country codes indicating the countries from which eligible users for the giveaway must come. If empty, then all users can participate in the giveaway. Users with a phone number that was bought on Fragment can always participate in giveaways.</summary>
public string[]? CountryCodes { get; set; }

/// <summary><em>Optional</em>. The number of months the Telegram Premium subscription won from the giveaway will be active for</summary>
/// <summary><em>Optional</em>. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only</summary>
public int? PrizeStarCount { get; set; }

/// <summary><em>Optional</em>. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only</summary>
public int? PremiumSubscriptionMonthCount { get; set; }
}
3 changes: 3 additions & 0 deletions src/Telegram.Bot/Types/GiveawayCompleted.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ public partial class GiveawayCompleted

/// <summary><em>Optional</em>. Message with the giveaway that was completed, if it wasn't deleted</summary>
public Message? GiveawayMessage { get; set; }

/// <summary><em>Optional</em>. <see langword="true"/>, if the giveaway is a Telegram Star giveaway. Otherwise, currently, the giveaway is a Telegram Premium giveaway.</summary>
public bool IsStarGiveaway { get; set; }
}
8 changes: 6 additions & 2 deletions src/Telegram.Bot/Types/GiveawayCreated.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace Telegram.Bot.Types;

/// <summary>This object represents a service message about the creation of a scheduled giveaway. Currently holds no information.</summary>
public partial class GiveawayCreated;
/// <summary>This object represents a service message about the creation of a scheduled giveaway.</summary>
public partial class GiveawayCreated
{
/// <summary><em>Optional</em>. The number of Telegram Stars to be split between giveaway winners; for Telegram Star giveaways only</summary>
public int? PrizeStarCount { get; set; }
}
5 changes: 4 additions & 1 deletion src/Telegram.Bot/Types/GiveawayWinners.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public partial class GiveawayWinners
/// <summary><em>Optional</em>. The number of other chats the user had to join in order to be eligible for the giveaway</summary>
public int? AdditionalChatCount { get; set; }

/// <summary><em>Optional</em>. The number of months the Telegram Premium subscription won from the giveaway will be active for</summary>
/// <summary><em>Optional</em>. The number of Telegram Stars that were split between giveaway winners; for Telegram Star giveaways only</summary>
public int? PrizeStarCount { get; set; }

/// <summary><em>Optional</em>. The number of months the Telegram Premium subscription won from the giveaway will be active for; for Telegram Premium giveaways only</summary>
public int? PremiumSubscriptionMonthCount { get; set; }

/// <summary><em>Optional</em>. Number of undistributed prizes</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public partial class InputInvoiceMessageContent : InputMessageContent
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required string Description { get; set; }

/// <summary>Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.</summary>
/// <summary>Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public required string Payload { get; set; }

Expand Down Expand Up @@ -222,7 +222,7 @@ public partial class InputInvoiceMessageContent : InputMessageContent
/// <summary>Initializes an instance of <see cref="InputInvoiceMessageContent"/></summary>
/// <param name="title">Product name, 1-32 characters</param>
/// <param name="description">Product description, 1-255 characters</param>
/// <param name="payload">Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.</param>
/// <param name="payload">Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.</param>
/// <param name="currency">Three-letter ISO 4217 currency code, see <a href="https://core.telegram.org/bots/payments#supported-currencies">more on currencies</a>. Pass “XTR” for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</param>
/// <param name="prices">Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>.</param>
[SetsRequiredMembers]
Expand Down
13 changes: 13 additions & 0 deletions src/Telegram.Bot/Types/Payments/PaidMediaPurchased.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Telegram.Bot.Types.Payments;

/// <summary>This object contains information about a paid media purchase.</summary>
public partial class PaidMediaPurchased
{
/// <summary>User who purchased the media</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public User From { get; set; } = default!;

/// <summary>Bot-specified paid media payload</summary>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public string PaidMediaPayload { get; set; } = default!;
}
3 changes: 3 additions & 0 deletions src/Telegram.Bot/Types/Payments/TransactionPartner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public partial class TransactionPartnerUser : TransactionPartner

/// <summary><em>Optional</em>. Information about the paid media bought by the user</summary>
public PaidMedia[]? PaidMedia { get; set; }

/// <summary><em>Optional</em>. Bot-specified paid media payload</summary>
public string? PaidMediaPayload { get; set; }
}

/// <summary>Describes a withdrawal transaction with Fragment.</summary>
Expand Down
Loading

0 comments on commit 9346899

Please sign in to comment.