Skip to content

Commit 4dd3440

Browse files
committed
update Bot API to 8.1
1 parent 1f7e826 commit 4dd3440

File tree

8 files changed

+87
-13
lines changed

8 files changed

+87
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![npm](https://img.shields.io/npm/dt/typescript-telegram-bot-api)](https://www.npmjs.com/package/typescript-telegram-bot-api)
55
[![codecov](https://codecov.io/github/Borodin/typescript-telegram-bot-api/graph/badge.svg?token=509N5AZDTV)](https://codecov.io/github/Borodin/typescript-telegram-bot-api)
66
[![codesandbox](https://img.shields.io/badge/Open_in-sandbox-eaff96)](https://codesandbox.io/p/sandbox/interesting-wave-qgspfs)
7-
[![GitHub](https://img.shields.io/badge/Bot_API-v8.0-0088cc)](https://core.telegram.org/bots/api#november-17-2024)
7+
[![GitHub](https://img.shields.io/badge/Bot_API-v8.1-0088cc)](https://core.telegram.org/bots/api#december-4-2024)
88

99

1010
This is a TypeScript wrapper for the [Telegram Bot API](https://core.telegram.org/bots/api) Node.js and browsers. It allows you to easily interact with the Telegram Bot API using TypeScript.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"type": "commonjs",
33
"name": "typescript-telegram-bot-api",
4-
"version": "0.5.0",
4+
"version": "0.6.0",
55
"description": "Telegram Bot API wrapper for Node.js written in TypeScript",
66
"repository": "github:Borodin/typescript-telegram-bot-api",
77
"main": "dist/index.js",

src/types/AffiliateInfo.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { User, Chat } from './';
2+
3+
/**
4+
* ## AffiliateInfo
5+
* Contains information about the affiliate that received a commission via this transaction.
6+
*/
7+
export type AffiliateInfo = {
8+
/**
9+
* Optional. The bot or the user that received an affiliate commission if it was received by a bot or a user
10+
*/
11+
affiliate_user?: User;
12+
13+
/**
14+
* Optional. The chat that received an affiliate commission if it was received by a chat
15+
*/
16+
affiliate_chat?: Chat;
17+
18+
/**
19+
* The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the bot from
20+
* referred users
21+
*/
22+
commission_per_mille: number;
23+
24+
/**
25+
* Integer amount of Telegram Stars received by the affiliate from the transaction, rounded to 0; can be negative for
26+
* refunds
27+
*/
28+
amount: number;
29+
30+
/**
31+
* Optional. The number of 1/1000000000 shares of Telegram Stars received by the affiliate;
32+
* from -999999999 to 999999999; can be negative for refunds
33+
*/
34+
nanostar_amount?: number;
35+
};

src/types/StarTransaction.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TransactionPartner } from './TransactionPartner';
1+
import { TransactionPartner } from './';
22

33
/**
44
* ## StarTransaction
@@ -18,6 +18,11 @@ export type StarTransaction = {
1818
*/
1919
amount: number;
2020

21+
/**
22+
* Optional. The number of 1/1000000000 shares of Telegram Stars transferred by the transaction; from 0 to 999999999
23+
*/
24+
nanostar_amount?: number;
25+
2126
/**
2227
* Date the transaction was created in Unix time
2328
*/

src/types/TransactionPartner.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
import { TransactionPartnerFragment } from './TransactionPartnerFragment';
2-
import { TransactionPartnerUser } from './TransactionPartnerUser';
3-
import { TransactionPartnerTelegramAds } from './TransactionPartnerTelegramAds';
4-
import { TransactionPartnerTelegramApi } from './TransactionPartnerTelegramApi';
5-
import { TransactionPartnerOther } from './TransactionPartnerOther';
1+
import {
2+
TransactionPartnerFragment,
3+
TransactionPartnerUser,
4+
TransactionPartnerTelegramAds,
5+
TransactionPartnerTelegramApi,
6+
TransactionPartnerOther,
7+
TransactionPartnerAffiliateProgram,
8+
} from './';
69

710
/**
811
* ## TransactionPartner
912
* This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be
1013
* one of
11-
* - TransactionPartnerFragment
1214
* - TransactionPartnerUser
15+
* - TransactionPartnerAffiliateProgram
16+
* - TransactionPartnerFragment
1317
* - TransactionPartnerTelegramAds
1418
* - TransactionPartnerTelegramApi
1519
* - TransactionPartnerOther
1620
* @see https://core.telegram.org/bots/api#transactionpartner
1721
*/
1822
export type TransactionPartner =
19-
| TransactionPartnerFragment
2023
| TransactionPartnerUser
24+
| TransactionPartnerAffiliateProgram
25+
| TransactionPartnerFragment
2126
| TransactionPartnerTelegramAds
2227
| TransactionPartnerTelegramApi
2328
| TransactionPartnerOther;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { User } from './';
2+
3+
/**
4+
* ## TransactionPartnerAffiliateProgram
5+
* Describes the affiliate program that issued the affiliate commission received via this transaction.
6+
* @see https://core.telegram.org/bots/api#transactionpartneraffiliateprogram
7+
*/
8+
export type TransactionPartnerAffiliateProgram = {
9+
/**
10+
* Type of the transaction partner, always “affiliate_program”
11+
*/
12+
type: 'affiliate_program';
13+
14+
/**
15+
* Optional. Information about the bot that sponsored the affiliate program
16+
*/
17+
sponsor_user?: User;
18+
19+
/**
20+
* The number of Telegram Stars received by the bot for each 1000 Telegram Stars received by the affiliate program
21+
* sponsor from referred users
22+
*/
23+
commission_per_mille: number;
24+
};

src/types/TransactionPartnerUser.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { User } from './User';
2-
import { PaidMedia } from './PaidMedia';
3-
import { Gift } from './Gift';
1+
import { User, PaidMedia, Gift, AffiliateInfo } from './';
42

53
/**
64
* ## TransactionPartnerUser
@@ -18,6 +16,11 @@ export type TransactionPartnerUser = {
1816
*/
1917
user: User;
2018

19+
/**
20+
* Optional. Information about the affiliate that received a commission via this transaction
21+
*/
22+
affiliate?: AffiliateInfo;
23+
2124
/**
2225
* Optional. Bot-specified invoice payload
2326
*/

src/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './AffiliateInfo';
12
export * from './Animation';
23
export * from './Audio';
34
export * from './BackgroundFill';
@@ -206,6 +207,7 @@ export * from './PaidMediaPreview';
206207
export * from './PaidMediaPurchased';
207208
export * from './PaidMediaVideo';
208209
export * from './TransactionPartner';
210+
export * from './TransactionPartnerAffiliateProgram';
209211
export * from './TransactionPartnerFragment';
210212
export * from './TransactionPartnerOther';
211213
export * from './TransactionPartnerTelegramAds';

0 commit comments

Comments
 (0)