Skip to content

Commit 755309f

Browse files
committed
Bot API 9.4
1 parent db28e25 commit 755309f

25 files changed

Lines changed: 276 additions & 37 deletions

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 9.3](https://img.shields.io/badge/Bot_API-9.3-f36caf.svg?style=flat-square)](https://core.telegram.org/bots/api)
4+
[![Bot API 9.4](https://img.shields.io/badge/Bot_API-9.4-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/Requests/Manage Chat/Topics/CreateForumTopicRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// GENERATED FILE - DO NOT MODIFY MANUALLY
22
namespace Telegram.Bot.Requests;
33

4-
/// <summary>Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the <em>CanManageTopics</em> administrator rights.<para>Returns: Information about the created topic as a <see cref="ForumTopic"/> object.</para></summary>
4+
/// <summary>Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the <em>CanManageTopics</em> administrator right.<para>Returns: Information about the created topic as a <see cref="ForumTopic"/> object.</para></summary>
55
[EditorBrowsable(EditorBrowsableState.Never)]
66
public partial class CreateForumTopicRequest() : RequestBase<ForumTopic>("createForumTopic"), IChatTargetable
77
{
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Use this method to get a list of profile audios for a user.<para>Returns: A <see cref="UserProfileAudios"/> object.</para></summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class GetUserProfileAudiosRequest() : RequestBase<UserProfileAudios>("getUserProfileAudios"), IUserTargetable
7+
{
8+
/// <summary>Unique identifier of the target user</summary>
9+
[JsonPropertyName("user_id")]
10+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
11+
public required long UserId { get; set; }
12+
13+
/// <summary>Sequential number of the first audio to be returned. By default, all audios are returned.</summary>
14+
public int? Offset { get; set; }
15+
16+
/// <summary>Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.</summary>
17+
public int? Limit { get; set; }
18+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Removes the profile photo of the bot.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class RemoveMyProfilePhotoRequest() : ParameterlessRequest<bool>("removeMyProfilePhoto")
7+
{}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// GENERATED FILE - DO NOT MODIFY MANUALLY
2+
namespace Telegram.Bot.Requests;
3+
4+
/// <summary>Changes the profile photo of the bot.</summary>
5+
[EditorBrowsable(EditorBrowsableState.Never)]
6+
public partial class SetMyProfilePhotoRequest() : FileRequestBase<bool>("setMyProfilePhoto")
7+
{
8+
/// <summary>The new profile photo to set</summary>
9+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
10+
public required InputProfilePhoto Photo { get; set; }
11+
}

src/Telegram.Bot/Serialization/JsonBotSerializerContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace Telegram.Bot;
3636
[JsonSerializable(typeof(SendChatActionRequest))]
3737
[JsonSerializable(typeof(SetMessageReactionRequest))]
3838
[JsonSerializable(typeof(GetUserProfilePhotosRequest))]
39+
[JsonSerializable(typeof(GetUserProfileAudiosRequest))]
3940
[JsonSerializable(typeof(SetUserEmojiStatusRequest))]
4041
[JsonSerializable(typeof(GetFileRequest))]
4142
[JsonSerializable(typeof(BanChatMemberRequest))]
@@ -93,6 +94,8 @@ namespace Telegram.Bot;
9394
[JsonSerializable(typeof(GetMyDescriptionRequest))]
9495
[JsonSerializable(typeof(SetMyShortDescriptionRequest))]
9596
[JsonSerializable(typeof(GetMyShortDescriptionRequest))]
97+
[JsonSerializable(typeof(SetMyProfilePhotoRequest))]
98+
[JsonSerializable(typeof(RemoveMyProfilePhotoRequest))]
9699
[JsonSerializable(typeof(SetChatMenuButtonRequest))]
97100
[JsonSerializable(typeof(GetChatMenuButtonRequest))]
98101
[JsonSerializable(typeof(SetMyDefaultAdministratorRightsRequest))]
@@ -185,6 +188,7 @@ namespace Telegram.Bot;
185188
[JsonSerializable(typeof(ApiResponse<MessageId>))]
186189
[JsonSerializable(typeof(ApiResponse<Message[]>))]
187190
[JsonSerializable(typeof(ApiResponse<UserProfilePhotos>))]
191+
[JsonSerializable(typeof(ApiResponse<UserProfileAudios>))]
188192
[JsonSerializable(typeof(ApiResponse<TGFile>))]
189193
[JsonSerializable(typeof(ApiResponse<string>))]
190194
[JsonSerializable(typeof(ApiResponse<ChatInviteLink>))]

src/Telegram.Bot/TelegramBotClientExtensions.ApiMethods.cs

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,26 @@ public static async Task<UserProfilePhotos> GetUserProfilePhotos(
13641364
Limit = limit,
13651365
}, cancellationToken).ConfigureAwait(false);
13661366

1367+
/// <summary>Use this method to get a list of profile audios for a user.</summary>
1368+
/// <param name="botClient">An instance of <see cref="ITelegramBotClient"/></param>
1369+
/// <param name="userId">Unique identifier of the target user</param>
1370+
/// <param name="offset">Sequential number of the first audio to be returned. By default, all audios are returned.</param>
1371+
/// <param name="limit">Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.</param>
1372+
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation</param>
1373+
/// <returns>A <see cref="UserProfileAudios"/> object.</returns>
1374+
public static async Task<UserProfileAudios> GetUserProfileAudios(
1375+
this ITelegramBotClient botClient,
1376+
long userId,
1377+
int? offset = default,
1378+
int? limit = default,
1379+
CancellationToken cancellationToken = default
1380+
) => await botClient.ThrowIfNull().SendRequest(new GetUserProfileAudiosRequest
1381+
{
1382+
UserId = userId,
1383+
Offset = offset,
1384+
Limit = limit,
1385+
}, cancellationToken).ConfigureAwait(false);
1386+
13671387
/// <summary>Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method <a href="https://core.telegram.org/bots/webapps#initializing-mini-apps">requestEmojiStatusAccess</a>.</summary>
13681388
/// <param name="botClient">An instance of <see cref="ITelegramBotClient"/></param>
13691389
/// <param name="userId">Unique identifier of the target user</param>
@@ -1986,7 +2006,7 @@ public static async Task<Sticker[]> GetForumTopicIconStickers(
19862006
{
19872007
}, cancellationToken).ConfigureAwait(false);
19882008

1989-
/// <summary>Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the <em>CanManageTopics</em> administrator rights.</summary>
2009+
/// <summary>Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the <em>CanManageTopics</em> administrator right.</summary>
19902010
/// <param name="botClient">An instance of <see cref="ITelegramBotClient"/></param>
19912011
/// <param name="chatId">Unique identifier for the target chat or username of the target supergroup (in the format <c>@supergroupusername</c>)</param>
19922012
/// <param name="name">Topic name, 1-128 characters</param>
@@ -2375,6 +2395,29 @@ public static async Task<BotShortDescription> GetMyShortDescription(
23752395
LanguageCode = languageCode,
23762396
}, cancellationToken).ConfigureAwait(false);
23772397

2398+
/// <summary>Changes the profile photo of the bot.</summary>
2399+
/// <param name="botClient">An instance of <see cref="ITelegramBotClient"/></param>
2400+
/// <param name="photo">The new profile photo to set</param>
2401+
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation</param>
2402+
public static async Task SetMyProfilePhoto(
2403+
this ITelegramBotClient botClient,
2404+
InputProfilePhoto photo,
2405+
CancellationToken cancellationToken = default
2406+
) => await botClient.ThrowIfNull().SendRequest(new SetMyProfilePhotoRequest
2407+
{
2408+
Photo = photo,
2409+
}, cancellationToken).ConfigureAwait(false);
2410+
2411+
/// <summary>Removes the profile photo of the bot.</summary>
2412+
/// <param name="botClient">An instance of <see cref="ITelegramBotClient"/></param>
2413+
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation</param>
2414+
public static async Task RemoveMyProfilePhoto(
2415+
this ITelegramBotClient botClient,
2416+
CancellationToken cancellationToken = default
2417+
) => await botClient.ThrowIfNull().SendRequest(new RemoveMyProfilePhotoRequest
2418+
{
2419+
}, cancellationToken).ConfigureAwait(false);
2420+
23782421
/// <summary>Use this method to change the bot's menu button in a private chat, or the default menu button.</summary>
23792422
/// <param name="botClient">An instance of <see cref="ITelegramBotClient"/></param>
23802423
/// <param name="chatId">Unique identifier for the target private chat. If not specified, default bot's menu button will be changed</param>

src/Telegram.Bot/Types/BackgroundType.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,3 @@ public partial class BackgroundTypeChatTheme : BackgroundType
9393
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
9494
public string ThemeName { get; set; } = default!;
9595
}
96-
97-
/// <summary>This object represents a chat background.</summary>
98-
public partial class ChatBackground
99-
{
100-
/// <summary>Type of the background</summary>
101-
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
102-
public BackgroundType Type { get; set; } = default!;
103-
104-
/// <summary>Implicit conversion to BackgroundType (Type)</summary>
105-
public static implicit operator BackgroundType(ChatBackground self) => self.Type;
106-
/// <summary>Implicit conversion from BackgroundType (Type)</summary>
107-
public static implicit operator ChatBackground(BackgroundType type) => new() { Type = type };
108-
}

src/Telegram.Bot/Types/Chat.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ public partial class ChatFullInfo : Chat
195195
/// <summary><em>Optional</em>. For private chats, the rating of the user if any</summary>
196196
public UserRating? Rating { get; set; }
197197

198+
/// <summary><em>Optional</em>. For private chats, the first audio added to the profile of the user</summary>
199+
[JsonPropertyName("first_profile_audio")]
200+
public Audio? FirstProfileAudio { get; set; }
201+
198202
/// <summary><em>Optional</em>. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews</summary>
199203
[JsonPropertyName("unique_gift_colors")]
200204
public UniqueGiftColors? UniqueGiftColors { get; set; }
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.Types;
3+
4+
/// <summary>This object represents a chat background.</summary>
5+
public partial class ChatBackground
6+
{
7+
/// <summary>Type of the background</summary>
8+
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
9+
public BackgroundType Type { get; set; } = default!;
10+
11+
/// <summary>Implicit conversion to BackgroundType (Type)</summary>
12+
public static implicit operator BackgroundType(ChatBackground self) => self.Type;
13+
/// <summary>Implicit conversion from BackgroundType (Type)</summary>
14+
public static implicit operator ChatBackground(BackgroundType type) => new() { Type = type };
15+
}

0 commit comments

Comments
 (0)