Skip to content

Commit ba03e43

Browse files
Merge pull request #53 from RxTelegram/v7.9
Add support for v7.9
2 parents 660f40a + f820777 commit ba03e43

File tree

11 files changed

+158
-4
lines changed

11 files changed

+158
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
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 7.8 (as at July 31, 2024).
8+
RxTelegram.Bot supports Telegram Bot API 7.9 (as at August 14, 2024).
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/ITelegramBot.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using RxTelegram.Bot.Interface.Games.Requests;
2020
using RxTelegram.Bot.Interface.InlineMode;
2121
using RxTelegram.Bot.Interface.Passport.Requests;
22+
using RxTelegram.Bot.Interface.Payments;
2223
using RxTelegram.Bot.Interface.Payments.Requests;
2324
using RxTelegram.Bot.Interface.Reaction.Requests;
2425
using RxTelegram.Bot.Interface.Setup;
@@ -1207,4 +1208,52 @@ Task<BusinessConnection> GetBusinessConnection(
12071208
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
12081209
/// <returns>Returns an array of <see cref="MessageIdObject"/> on success.</returns>
12091210
Task<MessageIdObject[]> CopyMessages(CopyMessages copyMessages, CancellationToken cancellationToken = default);
1211+
1212+
/// <summary>
1213+
/// Refunds a successful payment in Telegram Stars.
1214+
/// </summary>
1215+
/// <param name="refundStarPayment">Information about the payment</param>
1216+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1217+
/// <returns>Returns True on success.</returns>
1218+
Task<bool> RefundStarPayment(RefundStarPayment refundStarPayment, CancellationToken cancellationToken = default);
1219+
1220+
/// <summary>
1221+
/// Returns the bot's Telegram Star transactions in chronological order.
1222+
/// </summary>
1223+
/// <param name="getStarTransactions">Information about the transactions</param>
1224+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1225+
/// <returns>On success, returns a <see cref="StarTransactions"/> object.</returns>
1226+
Task<StarTransactions> GetStarTransactions(
1227+
GetStarTransactions getStarTransactions,
1228+
CancellationToken cancellationToken = default);
1229+
1230+
/// <summary>
1231+
/// Use this method to send paid media to channel chats.
1232+
/// </summary>
1233+
/// <param name="sendPaidMedia">Details for the media to send</param>
1234+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1235+
/// <returns>On success, the sent <see cref="Message"/> is returned.</returns>
1236+
Task<Message> SendPaidMedia(SendPaidMedia sendPaidMedia, CancellationToken cancellationToken = default);
1237+
1238+
/// <summary>
1239+
/// Use this method to create a subscription invite link for a channel chat.
1240+
/// The bot must have the can_invite_users administrator rights.
1241+
/// The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method <see cref="TelegramBot.RevokeChatInviteLink"/>.
1242+
/// </summary>
1243+
/// <param name="createChatSubscriptionInviteLink">Details for the invite link</param>
1244+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1245+
/// <returns>Returns the new invite link as a <see cref="ChatInviteLink"/> object.</returns>
1246+
Task<ChatInviteLink> CreateChatSubscriptionInviteLink(
1247+
CreateChatSubscriptionInviteLink createChatSubscriptionInviteLink,
1248+
CancellationToken cancellationToken = default);
1249+
1250+
/// <summary>
1251+
/// Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights
1252+
/// </summary>
1253+
/// <param name="editChatSubscriptionInviteLink">Details for the invite link</param>
1254+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1255+
/// <returns>Returns the new invite link as a <see cref="ChatInviteLink"/> object.</returns>
1256+
Task<ChatInviteLink> EditChatSubscriptionInviteLink(
1257+
EditChatSubscriptionInviteLink editChatSubscriptionInviteLink,
1258+
CancellationToken cancellationToken = default);
12101259
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Requests.Base;
2+
using RxTelegram.Bot.Validation;
3+
4+
namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Chats;
5+
6+
/// <summary>
7+
/// Use this method to create a subscription invite link for a channel chat.
8+
/// The bot must have the can_invite_users administrator rights.
9+
/// The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method <see cref="RevokeChatInviteLink"/>.
10+
/// Returns the new invite link as a ChatInviteLink object.
11+
/// </summary>
12+
public class CreateChatSubscriptionInviteLink : BaseRequest
13+
{
14+
/// <summary>
15+
/// Invite link name; 0-32 characters
16+
/// </summary>
17+
public string Name { get; set; }
18+
19+
/// <summary>
20+
/// The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
21+
/// </summary>
22+
public int SubscriptionPeriod { get; set; }
23+
24+
/// <summary>
25+
/// The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-2500
26+
/// </summary>
27+
public int SubscriptionPrice { get; set; }
28+
29+
protected override IValidationResult Validate() => this.CreateValidation();
30+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using RxTelegram.Bot.Interface.BaseTypes.Requests.Base;
2+
using RxTelegram.Bot.Validation;
3+
4+
namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Chats;
5+
6+
/// <summary>
7+
/// Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights.
8+
/// </summary>
9+
public class EditChatSubscriptionInviteLink : BaseRequest
10+
{
11+
/// <summary>
12+
/// The invite link to edit
13+
/// </summary>
14+
public string InviteLink { get; set; }
15+
16+
/// <summary>
17+
/// Invite link name; 0-32 characters
18+
/// </summary>
19+
public string Name { get; set; }
20+
21+
protected override IValidationResult Validate() => this.CreateValidation();
22+
}

src/RxTelegram.Bot/Interface/BaseTypes/Requests/Messages/SendPaidMedia.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ namespace RxTelegram.Bot.Interface.BaseTypes.Requests.Messages;
1111
/// </summary>
1212
public class SendPaidMedia : BaseTextRequest
1313
{
14+
/// <summary>
15+
/// Unique identifier of the business connection on behalf of which the message will be sent
16+
/// </summary>
17+
public string BusinessConnectionId { get; set; }
18+
1419
/// <summary>
1520
/// The number of Telegram Stars that must be paid to buy access to the media
1621
/// </summary>

src/RxTelegram.Bot/Interface/Payments/TransactionPartnerUser.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections.Generic;
12
using RxTelegram.Bot.Interface.BaseTypes;
23
using RxTelegram.Bot.Interface.BaseTypes.Enums;
34

@@ -22,4 +23,6 @@ public class TransactionPartnerUser : TransactionPartner
2223
/// Optional. Bot-specified invoice payload
2324
/// </summary>
2425
public string InvoicePayload { get; set; }
26+
27+
public List<PaidMedia> PaidMedia { get; set; }
2528
}

src/RxTelegram.Bot/Interface/Reaction/Enums/ReactionType.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ public enum ReactionType
88
Emoji,
99

1010
[ImplementationType(typeof(ReactionTypeCustomEmoji))]
11-
CustomEmoji
11+
CustomEmoji,
12+
13+
[ImplementationType(typeof(ReactionTypePaid))]
14+
Paid
1215
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace RxTelegram.Bot.Interface.Reaction;
2+
3+
public class ReactionTypePaid : ReactionType
4+
{
5+
public override Enums.ReactionType Type { get; set; } = Enums.ReactionType.Paid;
6+
}

src/RxTelegram.Bot/RxTelegram.Bot.csproj

Lines changed: 1 addition & 1 deletion
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>7.8.0</PackageVersion>
13+
<PackageVersion>7.9.0</PackageVersion>
1414
<PackageIcon>icon.png</PackageIcon>
1515
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1616
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>

src/RxTelegram.Bot/TelegramBot.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,9 @@ public Task<bool> RefundStarPayment(RefundStarPayment refundStarPayment, Cancell
13471347
/// <param name="getStarTransactions">Information about the transactions</param>
13481348
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
13491349
/// <returns>On success, returns a <see cref="StarTransactions"/> object.</returns>
1350-
public Task<StarTransactions> GetStarTransactions(GetStarTransactions getStarTransactions, CancellationToken cancellationToken = default) =>
1350+
public Task<StarTransactions> GetStarTransactions(
1351+
GetStarTransactions getStarTransactions,
1352+
CancellationToken cancellationToken = default) =>
13511353
Post<StarTransactions>("getStarTransactions", getStarTransactions, cancellationToken);
13521354

13531355
/// <summary>
@@ -1358,4 +1360,28 @@ public Task<StarTransactions> GetStarTransactions(GetStarTransactions getStarTra
13581360
/// <returns>On success, the sent <see cref="Message"/> is returned.</returns>
13591361
public Task<Message> SendPaidMedia(SendPaidMedia sendPaidMedia, CancellationToken cancellationToken = default) =>
13601362
Post<Message>("sendPaidMedia", sendPaidMedia, cancellationToken);
1363+
1364+
/// <summary>
1365+
/// Use this method to create a subscription invite link for a channel chat.
1366+
/// The bot must have the can_invite_users administrator rights.
1367+
/// The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method <see cref="RevokeChatInviteLink"/>.
1368+
/// </summary>
1369+
/// <param name="createChatSubscriptionInviteLink">Details for the invite link</param>
1370+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1371+
/// <returns>Returns the new invite link as a <see cref="ChatInviteLink"/> object.</returns>
1372+
public Task<ChatInviteLink> CreateChatSubscriptionInviteLink(
1373+
CreateChatSubscriptionInviteLink createChatSubscriptionInviteLink,
1374+
CancellationToken cancellationToken = default) =>
1375+
Post<ChatInviteLink>("createChatSubscriptionInviteLink", createChatSubscriptionInviteLink, cancellationToken);
1376+
1377+
/// <summary>
1378+
/// Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights
1379+
/// </summary>
1380+
/// <param name="editChatSubscriptionInviteLink">Details for the invite link</param>
1381+
/// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
1382+
/// <returns>Returns the new invite link as a <see cref="ChatInviteLink"/> object.</returns>
1383+
public Task<ChatInviteLink> EditChatSubscriptionInviteLink(
1384+
EditChatSubscriptionInviteLink editChatSubscriptionInviteLink,
1385+
CancellationToken cancellationToken = default) =>
1386+
Post<ChatInviteLink>("editChatSubscriptionInviteLink", editChatSubscriptionInviteLink, cancellationToken);
13611387
}

0 commit comments

Comments
 (0)