Skip to content

Commit 16410ba

Browse files
committed
Bot API 9.0
1 parent 1d189a6 commit 16410ba

File tree

56 files changed

+1714
-129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1714
-129
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# .NET Client for Telegram Bot API
22

33
[![Nuget](https://img.shields.io/nuget/vpre/Telegram.Bot.svg?label=Telegram.Bot&style=flat-square&color=d8b541)](https://www.nuget.org/packages/Telegram.Bot)
4-
[![Bot API 8.3](https://img.shields.io/badge/Bot_API-8.3-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api)
4+
[![Bot API 9.0](https://img.shields.io/badge/Bot_API-9.0-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api)
55
[![Documentations](https://img.shields.io/badge/Documentations-Book-orange.svg?style=flat-square)](https://telegrambots.github.io/book/)
66
[![Telegram Chat](https://img.shields.io/badge/Support_Chat-Telegram-blue.svg?style=flat-square)](https://t.me/joinchat/B35YY0QbLfd034CFnvCtCA)
77
[![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)

src/Telegram.Bot/Extend.Types.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public partial class Message
6262
{ Text: { } } or { Animation: { } } or { Audio: { } } or { Document: { } } or { PaidMedia: { } } or
6363
{ Photo: { } } or { Sticker: { } } or { Story: { } } or { Video: { } } or { VideoNote: { } } or { Voice: { } } or
6464
{ Contact: { } } or { Dice: { } } or { Game: { } } or { Poll: { } } or { Venue: { } } or { Location: { } } or
65-
{ Invoice: { } } or { Giveaway: { } } or { GiveawayWinners: { } } => false,
65+
{ Invoice: { } } or { Giveaway: { } } or { GiveawayWinners: { } } or { Gift: { } } or { UniqueGift: { } } => false,
6666
_ => true
6767
};
6868
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Converts a given regular gift to Telegram Stars. Requires the <em>CanConvertGiftsToStars</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class ConvertGiftToStarsRequest() : RequestBase<bool>("convertGiftToStars"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Unique identifier of the regular gift that should be converted to Telegram Stars</summary>
14+
[JsonPropertyName("owned_gift_id")]
15+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
16+
public required string OwnedGiftId { get; set; }
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Delete messages on behalf of a business account. Requires the <em>CanDeleteOutgoingMessages</em> business bot right to delete messages sent by the bot itself, or the <em>CanDeleteAllMessages</em> business bot right to delete any message.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class DeleteBusinessMessagesRequest() : RequestBase<bool>("deleteBusinessMessages"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection on behalf of which to delete the messages</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>A list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See <see cref="TelegramBotClientExtensions.DeleteMessage">DeleteMessage</see> for limitations on which messages can be deleted</summary>
14+
[JsonPropertyName("message_ids")]
15+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
16+
public required IEnumerable<int> MessageIds { get; set; }
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Deletes a story previously posted by the bot on behalf of a managed business account. Requires the <em>CanManageStories</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class DeleteStoryRequest() : RequestBase<bool>("deleteStory"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Unique identifier of the story to delete</summary>
14+
[JsonPropertyName("story_id")]
15+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
16+
public required int StoryId { get; set; }
17+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Edits a story previously posted by the bot on behalf of a managed business account. Requires the <em>CanManageStories</em> business bot right.<para>Returns: <see cref="Story"/> on success.</para></summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class EditStoryRequest() : FileRequestBase<Story>("editStory"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Unique identifier of the story to edit</summary>
14+
[JsonPropertyName("story_id")]
15+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
16+
public required int StoryId { get; set; }
17+
18+
/// <summary>Content of the story</summary>
19+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
20+
public required InputStoryContent Content { get; set; }
21+
22+
/// <summary>Caption of the story, 0-2048 characters after entities parsing</summary>
23+
public string? Caption { get; set; }
24+
25+
/// <summary>Mode for parsing entities in the story caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.</summary>
26+
[JsonPropertyName("parse_mode")]
27+
public ParseMode ParseMode { get; set; }
28+
29+
/// <summary>A list of special entities that appear in the caption, which can be specified instead of <see cref="ParseMode">ParseMode</see></summary>
30+
[JsonPropertyName("caption_entities")]
31+
public IEnumerable<MessageEntity>? CaptionEntities { get; set; }
32+
33+
/// <summary>A list of clickable areas to be shown on the story</summary>
34+
public IEnumerable<StoryArea>? Areas { get; set; }
35+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Returns the gifts received and owned by a managed business account. Requires the <em>CanViewGiftsAndStars</em> business bot right.<para>Returns: <see cref="OwnedGifts"/> on success.</para></summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class GetBusinessAccountGiftsRequest() : RequestBase<OwnedGifts>("getBusinessAccountGifts"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Pass <see langword="true"/> to exclude gifts that aren't saved to the account's profile page</summary>
14+
[JsonPropertyName("exclude_unsaved")]
15+
public bool ExcludeUnsaved { get; set; }
16+
17+
/// <summary>Pass <see langword="true"/> to exclude gifts that are saved to the account's profile page</summary>
18+
[JsonPropertyName("exclude_saved")]
19+
public bool ExcludeSaved { get; set; }
20+
21+
/// <summary>Pass <see langword="true"/> to exclude gifts that can be purchased an unlimited number of times</summary>
22+
[JsonPropertyName("exclude_unlimited")]
23+
public bool ExcludeUnlimited { get; set; }
24+
25+
/// <summary>Pass <see langword="true"/> to exclude gifts that can be purchased a limited number of times</summary>
26+
[JsonPropertyName("exclude_limited")]
27+
public bool ExcludeLimited { get; set; }
28+
29+
/// <summary>Pass <see langword="true"/> to exclude unique gifts</summary>
30+
[JsonPropertyName("exclude_unique")]
31+
public bool ExcludeUnique { get; set; }
32+
33+
/// <summary>Pass <see langword="true"/> to sort results by gift price instead of send date. Sorting is applied before pagination.</summary>
34+
[JsonPropertyName("sort_by_price")]
35+
public bool SortByPrice { get; set; }
36+
37+
/// <summary>Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results</summary>
38+
public string? Offset { get; set; }
39+
40+
/// <summary>The maximum number of gifts to be returned; 1-100. Defaults to 100</summary>
41+
public int? Limit { get; set; }
42+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Returns the amount of Telegram Stars owned by a managed business account. Requires the <em>CanViewGiftsAndStars</em> business bot right.<para>Returns: <see cref="StarAmount"/> on success.</para></summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class GetBusinessAccountStarBalanceRequest() : RequestBase<StarAmount>("getBusinessAccountStarBalance"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Posts a story on behalf of a managed business account. Requires the <em>CanManageStories</em> business bot right.<para>Returns: <see cref="Story"/> on success.</para></summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class PostStoryRequest() : FileRequestBase<Story>("postStory"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Content of the story</summary>
14+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
15+
public required InputStoryContent Content { get; set; }
16+
17+
/// <summary>Period after which the story is moved to the archive, in seconds; must be one of <c>6 * 3600</c>, <c>12 * 3600</c>, <c>86400</c>, or <c>2 * 86400</c></summary>
18+
[JsonPropertyName("active_period")]
19+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
20+
public required int ActivePeriod { get; set; }
21+
22+
/// <summary>Caption of the story, 0-2048 characters after entities parsing</summary>
23+
public string? Caption { get; set; }
24+
25+
/// <summary>Mode for parsing entities in the story caption. See <a href="https://core.telegram.org/bots/api#formatting-options">formatting options</a> for more details.</summary>
26+
[JsonPropertyName("parse_mode")]
27+
public ParseMode ParseMode { get; set; }
28+
29+
/// <summary>A list of special entities that appear in the caption, which can be specified instead of <see cref="ParseMode">ParseMode</see></summary>
30+
[JsonPropertyName("caption_entities")]
31+
public IEnumerable<MessageEntity>? CaptionEntities { get; set; }
32+
33+
/// <summary>A list of clickable areas to be shown on the story</summary>
34+
public IEnumerable<StoryArea>? Areas { get; set; }
35+
36+
/// <summary>Pass <see langword="true"/> to keep the story accessible after it expires</summary>
37+
[JsonPropertyName("post_to_chat_page")]
38+
public bool PostToChatPage { get; set; }
39+
40+
/// <summary>Pass <see langword="true"/> if the content of the story must be protected from forwarding and screenshotting</summary>
41+
[JsonPropertyName("protect_content")]
42+
public bool ProtectContent { get; set; }
43+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Marks incoming message as read on behalf of a business account. Requires the <em>CanReadMessages</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class ReadBusinessMessageRequest() : RequestBase<bool>("readBusinessMessage"), IChatTargetable, IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection on behalf of which to read the message</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.</summary>
14+
[JsonPropertyName("chat_id")]
15+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
16+
public required long ChatId { get; set; }
17+
18+
/// <summary>Unique identifier of the message to mark as read</summary>
19+
[JsonPropertyName("message_id")]
20+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
21+
public required int MessageId { get; set; }
22+
23+
/// <inheritdoc/>
24+
ChatId IChatTargetable.ChatId => ChatId;
25+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Removes the current profile photo of a managed business account. Requires the <em>CanEditProfilePhoto</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class RemoveBusinessAccountProfilePhotoRequest() : RequestBase<bool>("removeBusinessAccountProfilePhoto"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Pass <see langword="true"/> to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo.</summary>
14+
[JsonPropertyName("is_public")]
15+
public bool IsPublic { get; set; }
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Changes the bio of a managed business account. Requires the <em>CanChangeBio</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class SetBusinessAccountBioRequest() : RequestBase<bool>("setBusinessAccountBio"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>The new value of the bio for the business account; 0-140 characters</summary>
14+
public string? Bio { get; set; }
15+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the <em>CanChangeGiftSettings</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class SetBusinessAccountGiftSettingsRequest() : RequestBase<bool>("setBusinessAccountGiftSettings"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Pass <see langword="true"/>, if a button for sending a gift to the user or by the business account must always be shown in the input field</summary>
14+
[JsonPropertyName("show_gift_button")]
15+
public required bool ShowGiftButton { get; set; }
16+
17+
/// <summary>Types of gifts accepted by the business account</summary>
18+
[JsonPropertyName("accepted_gift_types")]
19+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
20+
public required AcceptedGiftTypes AcceptedGiftTypes { get; set; }
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Changes the first and last name of a managed business account. Requires the <em>CanChangeName</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class SetBusinessAccountNameRequest() : RequestBase<bool>("setBusinessAccountName"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>The new value of the first name for the business account; 1-64 characters</summary>
14+
[JsonPropertyName("first_name")]
15+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
16+
public required string FirstName { get; set; }
17+
18+
/// <summary>The new value of the last name for the business account; 0-64 characters</summary>
19+
[JsonPropertyName("last_name")]
20+
public string? LastName { get; set; }
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Changes the profile photo of a managed business account. Requires the <em>CanEditProfilePhoto</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class SetBusinessAccountProfilePhotoRequest() : FileRequestBase<bool>("setBusinessAccountProfilePhoto"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>The new profile photo to set</summary>
14+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
15+
public required InputProfilePhoto Photo { get; set; }
16+
17+
/// <summary>Pass <see langword="true"/> to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo.</summary>
18+
[JsonPropertyName("is_public")]
19+
public bool IsPublic { get; set; }
20+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Changes the username of a managed business account. Requires the <em>CanChangeUsername</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class SetBusinessAccountUsernameRequest() : RequestBase<bool>("setBusinessAccountUsername"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>The new value of the username for the business account; 0-32 characters</summary>
14+
public string? Username { get; set; }
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Transfers Telegram Stars from the business account balance to the bot's balance. Requires the <em>CanTransferStars</em> business bot right.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class TransferBusinessAccountStarsRequest() : RequestBase<bool>("transferBusinessAccountStars"), IBusinessConnectable
7+
{
8+
/// <summary>Unique identifier of the business connection</summary>
9+
[JsonPropertyName("business_connection_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required string BusinessConnectionId { get; set; }
12+
13+
/// <summary>Number of Telegram Stars to transfer; 1-10000</summary>
14+
[JsonPropertyName("star_count")]
15+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
16+
public required int StarCount { get; set; }
17+
}

0 commit comments

Comments
 (0)