Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for api v8.1 #66

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![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)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=RxTelegram_RxTelegram.Bot&metric=coverage)](https://sonarcloud.io/summary/new_code?id=RxTelegram_RxTelegram.Bot)

RxTelegram.Bot supports Telegram Bot API 8.0 (as at November 17, 2024).
RxTelegram.Bot supports Telegram Bot API 8.1 (as at December 4, 2024).

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ public enum TransactionPartnerType
[ImplementationType(typeof(TransactionPartnerTelegramAds))]
TelegramAds,


[ImplementationType(typeof(TransactionPartnerOther))]
Other,

[ImplementationType(typeof(TransactionPartnerTelegramApi))]
TelegramApi
TelegramApi,

[ImplementationType(typeof(TransactionPartnerAffiliateProgram))]
AffiliateProgram
}
36 changes: 36 additions & 0 deletions src/RxTelegram.Bot/Interface/Payments/AffiliateInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using RxTelegram.Bot.Interface.BaseTypes;

namespace RxTelegram.Bot.Interface.Payments;

/// <summary>
/// Contains information about the affiliate that received a commission via this transaction.
/// </summary>
public class AffiliateInfo
{
/// <summary>
/// Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user
/// </summary>
public User AffiliateUser { get; set; }

/// <summary>
/// Optional. The chat that received an affiliate commission if it was received by a chat
/// </summary>
public Chat AffiliateChat { get; set; }

/// <summary>
/// The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from referred users
/// </summary>
public int CommissionPerMille { get; set; }

/// <summary>
/// Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0;
/// can be negative for refunds
/// </summary>
public int Amount { get; set; }

/// <summary>
/// Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate; from -999999999 to 999999999;
/// can be negative for refunds
/// </summary>
public int? NanostarAmount { get; set; }
}
5 changes: 5 additions & 0 deletions src/RxTelegram.Bot/Interface/Payments/StarTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public class StarTransaction
/// </summary>
public int Amount { get; set; }

/// <summary>
/// Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999
/// </summary>
public int? NanostarAmount { get; set; }

/// <summary>
/// Date the transaction was created in Unix time
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using RxTelegram.Bot.Interface.BaseTypes;
using RxTelegram.Bot.Interface.BaseTypes.Enums;

namespace RxTelegram.Bot.Interface.Payments;

/// <summary>
/// Describes the affiliate program that issued the affiliate commission received via this transaction.
/// </summary>
public class TransactionPartnerAffiliateProgram : TransactionPartner
{
/// <summary>
/// Type of the transaction partner, always “affiliate_program”
/// </summary>
public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.AffiliateProgram;

/// <summary>
/// Optional. Information about the bot that sponsored the affiliate program
/// </summary>
public User SponsorUser { get; set; }

/// <summary>
/// The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program sponsor from referred users
/// </summary>
public int CommissionPerMille { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class TransactionPartnerOther : TransactionPartner
/// <summary>
/// Type of the transaction partner, always “other”
/// </summary>
public override TransactionPartnerType Type { get; set; }
public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.Other;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class TransactionPartnerTelegramAds : TransactionPartner
/// <summary>
/// Type of the transaction partner, always “telegram_ads”
/// </summary>
public override TransactionPartnerType Type { get; set; }
public override TransactionPartnerType Type { get; set; } = TransactionPartnerType.TelegramAds;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class TransactionPartnerUser : TransactionPartner
/// </summary>
public User User { get; set; }

public AffiliateInfo Affiliate { get; set; }

/// <summary>
/// Optional. Bot-specified invoice payload
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/RxTelegram.Bot/RxTelegram.Bot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<RepositoryUrl>https://github.com/RxTelegram/RxTelegram.Bot</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Telegram;Bot;Api;Rx;Reactive;Observable;RxTelegram;RxTelegram.Bot</PackageTags>
<PackageVersion>8.0.0</PackageVersion>
<PackageVersion>8.1.0</PackageVersion>
<PackageIcon>icon.png</PackageIcon>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
Expand Down
Loading