Skip to content

Commit 2e8492b

Browse files
Merge pull request #67 from RxTelegram/v8.2.0
Add support for api v8.2
2 parents 20f621b + 479ab5c commit 2e8492b

File tree

11 files changed

+147
-9
lines changed

11 files changed

+147
-9
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot)
66
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=coverage)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot)
77

8-
RxTelegram.Bot supports Telegram Bot API 8.1 (as at December 4, 2024).
8+
RxTelegram.Bot supports Telegram Bot API 8.2 (as at January 1, 2025).
99

1010
This is a reactive designed .NET Library for the Telegram Bot API. It works with the official [Reactive Extentions](https://github.com/dotnet/reactive).
1111

src/RxTelegram.Bot/Interface/InlineMode/InlineQueryResults/InlineQueryResultArticle.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ public class InlineQueryResultArticle : BaseInlineQueryResultMedia
1515
/// </summary>
1616
public string Url { get; set; }
1717

18-
/// <summary>
19-
/// Optional.
20-
/// Pass True, if you don't want the URL to be shown in the message
21-
/// </summary>
22-
public bool? HideUrl { get; set; }
23-
2418
/// <summary>
2519
/// Optional.
2620
/// Short description of the result
@@ -46,4 +40,4 @@ public class InlineQueryResultArticle : BaseInlineQueryResultMedia
4640
public int? ThumbnailHeight { get; set; }
4741

4842
protected override IValidationResult Validate() => this.CreateValidation();
49-
}
43+
}

src/RxTelegram.Bot/Interface/Stickers/Gift.cs

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public class Gift
2020
/// </summary>
2121
public int StarCount { get; set; }
2222

23+
/// <summary>
24+
/// Optional. The number of Telegram Stars that must be paid to upgrade the gift to a unique one
25+
/// </summary>
26+
public int? UpgradeStarCount { get; set; }
27+
2328
/// <summary>
2429
/// Optional. The total number of the gifts of this type that can be sent; for limited gifts only
2530
/// </summary>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using RxTelegram.Bot.Interface.BaseTypes;
2+
using RxTelegram.Bot.Interface.Validation;
3+
using RxTelegram.Bot.Validation;
4+
5+
namespace RxTelegram.Bot.Interface.Stickers.Requests;
6+
7+
/// <summary>
8+
/// Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
9+
/// Returns True on success.
10+
/// </summary>
11+
public class RemoveChatVerification : BaseValidation
12+
{
13+
/// <summary>
14+
/// Unique identifier for the target chat or username of the target channel (in the format @channelusername)
15+
/// </summary>
16+
public ChatId ChatId { get; set; }
17+
18+
protected override IValidationResult Validate() => this.CreateValidation();
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using RxTelegram.Bot.Interface.Validation;
2+
using RxTelegram.Bot.Validation;
3+
4+
namespace RxTelegram.Bot.Interface.Stickers.Requests;
5+
6+
/// <summary>
7+
/// Removes verification from a user who is currently verified on behalf of the organization represented by the bot.
8+
/// Returns True on success.
9+
/// </summary>
10+
public class RemoveUserVerification : BaseValidation
11+
{
12+
/// <summary>
13+
/// User identifier of the user to be removed
14+
/// </summary>
15+
public long UserId { get; set; }
16+
17+
protected override IValidationResult Validate() => this.CreateValidation();
18+
}

src/RxTelegram.Bot/Interface/Stickers/Requests/SendGift.cs

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public class SendGift : BaseValidation
2020
/// </summary>
2121
public string GiftId { get; set; }
2222

23+
/// <summary>
24+
/// Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
25+
/// </summary>
26+
public bool PayForUpgrade { get; set; }
27+
2328
/// <summary>
2429
/// Text that will be shown along with the gift; 0-255 characters
2530
/// </summary>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using RxTelegram.Bot.Interface.BaseTypes;
2+
using RxTelegram.Bot.Interface.Validation;
3+
using RxTelegram.Bot.Validation;
4+
5+
namespace RxTelegram.Bot.Interface.Stickers.Requests;
6+
7+
/// <summary>
8+
/// Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
9+
/// </summary>
10+
public class VerifyChat : BaseValidation
11+
{
12+
/// <summary>
13+
/// Unique identifier for the target chat or username of the target channel (in the format @channelusername)
14+
/// </summary>
15+
public ChatId ChatId { get; set; }
16+
17+
/// <summary>
18+
/// Custom description for the verification; 0-70 characters.
19+
/// Must be empty if the organization isn't allowed to provide a custom verification description.
20+
/// </summary>
21+
public string CustomDescription { get; set; }
22+
23+
protected override IValidationResult Validate() => this.CreateValidation();
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using RxTelegram.Bot.Interface.Validation;
2+
using RxTelegram.Bot.Validation;
3+
4+
namespace RxTelegram.Bot.Interface.Stickers.Requests;
5+
6+
/// <summary>
7+
/// Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.
8+
/// </summary>
9+
public class VerifyUser : BaseValidation
10+
{
11+
/// <summary>
12+
/// User identifier of the user to be verified
13+
/// </summary>
14+
public long UserId { get; set; }
15+
16+
/// <summary>
17+
/// Custom description for the verification; 0-70 characters.
18+
/// Must be empty if the organization isn't allowed to provide a custom verification description.
19+
/// </summary>
20+
public string CustomDescription { get; set; }
21+
22+
protected override IValidationResult Validate() => this.CreateValidation();
23+
}

src/RxTelegram.Bot/RxTelegram.Bot.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<RepositoryUrl>https://github.com/RxTelegram/RxTelegram.Bot</RepositoryUrl>
1111
<RepositoryType>git</RepositoryType>
1212
<PackageTags>Telegram;Bot;Api;Rx;Reactive;Observable;RxTelegram;RxTelegram.Bot</PackageTags>
13-
<PackageVersion>8.1.0</PackageVersion>
13+
<PackageVersion>8.2.0</PackageVersion>
1414
<PackageIcon>icon.png</PackageIcon>
1515
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1616
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>

src/RxTelegram.Bot/TelegramBot.cs

+38
Original file line numberDiff line numberDiff line change
@@ -1432,4 +1432,42 @@ public Task<GiftsObject> GetAvailableGifts(CancellationToken cancellationToken =
14321432
/// <returns>Returns True on success.</returns>
14331433
public Task<bool> SendGift(SendGift sendGift, CancellationToken cancellationToken = default) =>
14341434
Post<bool>("sendGift", sendGift, cancellationToken);
1435+
1436+
/// <summary>
1437+
/// Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.
1438+
/// </summary>
1439+
/// <param name="verifyUser">The user to verify</param>
1440+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1441+
/// <returns>Returns True on success.</returns>
1442+
public Task<bool> VerifyUser(VerifyUser verifyUser, CancellationToken cancellationToken = default) =>
1443+
Post<bool>("verifyUser", verifyUser, cancellationToken);
1444+
1445+
/// <summary>
1446+
/// Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
1447+
/// </summary>
1448+
/// <param name="verifyChat">The chat to verify</param>
1449+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1450+
/// <returns>Returns True on success.</returns>
1451+
public Task<bool> VerifyChat(VerifyChat verifyChat, CancellationToken cancellationToken = default) =>
1452+
Post<bool>("verifyChat", verifyChat, cancellationToken);
1453+
1454+
/// <summary>
1455+
/// Removes verification from a user who is currently verified on behalf of the organization represented by the bot.
1456+
/// Returns True on success.
1457+
/// </summary>
1458+
/// <param name="removeUserVerification">The user to remove verification from</param>
1459+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1460+
/// <returns>Returns True on success.</returns>
1461+
public Task<bool> RemoveUserVerification(RemoveUserVerification removeUserVerification, CancellationToken cancellationToken = default) =>
1462+
Post<bool>("removeUserVerification", removeUserVerification, cancellationToken);
1463+
1464+
/// <summary>
1465+
/// Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
1466+
/// Returns True on success.
1467+
/// </summary>
1468+
/// <param name="removeChatVerification">The chat to remove verification from</param>
1469+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1470+
/// <returns>Returns True on success.</returns>
1471+
public Task<bool> RemoveChatVerification(RemoveChatVerification removeChatVerification, CancellationToken cancellationToken = default) =>
1472+
Post<bool>("removeChatVerification", removeChatVerification, cancellationToken);
14351473
}

src/RxTelegram.Bot/Validation/ValidationResultFactory.cs

+12
Original file line numberDiff line numberDiff line change
@@ -684,4 +684,16 @@ public static ValidationResult<SavePreparedInlineMessage> CreateValidation(this
684684
public static ValidationResult<SendGift> CreateValidation(this SendGift value) => new ValidationResult<SendGift>(value)
685685
.ValidateRequired(x => x.UserId)
686686
.ValidateRequired(x => x.GiftId);
687+
688+
public static ValidationResult<VerifyUser> CreateValidation(this VerifyUser value) =>
689+
new ValidationResult<VerifyUser>(value).ValidateRequired(x => x.UserId);
690+
691+
public static ValidationResult<VerifyChat> CreateValidation(this VerifyChat value) =>
692+
new ValidationResult<VerifyChat>(value).ValidateRequired(x => x.ChatId);
693+
694+
public static ValidationResult<RemoveUserVerification> CreateValidation(this RemoveUserVerification value) =>
695+
new ValidationResult<RemoveUserVerification>(value).ValidateRequired(x => x.UserId);
696+
697+
public static ValidationResult<RemoveChatVerification> CreateValidation(this RemoveChatVerification value) =>
698+
new ValidationResult<RemoveChatVerification>(value).ValidateRequired(x => x.ChatId);
687699
}

0 commit comments

Comments
 (0)