Skip to content

Commit 0f50b4a

Browse files
committed
update Bot API to 8.3
1 parent bcffb19 commit 0f50b4a

14 files changed

+105
-19
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.2-0088cc)](https://core.telegram.org/bots/api#january-1-2025)
7+
[![GitHub](https://img.shields.io/badge/Bot_API-v8.3-0088cc)](https://core.telegram.org/bots/api#february-12-2025)
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.7.0",
4+
"version": "0.8.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/index.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import {
6767
Gifts,
6868
} from './types/';
6969
import * as TelegramTypes from './types/';
70+
import { ExactlyOne } from './utils';
7071

7172
const wait: (ms: number) => Promise<void> = promisify(setTimeout);
7273

@@ -499,6 +500,7 @@ export class TelegramBot extends EventEmitter {
499500
chat_id: number | string;
500501
message_thread_id?: number;
501502
from_chat_id: number | string;
503+
video_start_timestamp?: number;
502504
disable_notification?: boolean;
503505
protect_content?: boolean;
504506
message_id: number;
@@ -543,6 +545,7 @@ export class TelegramBot extends EventEmitter {
543545
message_thread_id?: number;
544546
from_chat_id: number | string;
545547
message_id: number;
548+
video_start_timestamp?: number;
546549
caption?: string;
547550
parse_mode?: ParseMode;
548551
caption_entities?: MessageEntity[];
@@ -721,6 +724,8 @@ export class TelegramBot extends EventEmitter {
721724
width?: number;
722725
height?: number;
723726
thumbnail?: InputFile | string;
727+
cover?: InputFile | string;
728+
start_timestamp?: number;
724729
caption?: string;
725730
parse_mode?: ParseMode;
726731
caption_entities?: MessageEntity[];
@@ -2601,14 +2606,19 @@ export class TelegramBot extends EventEmitter {
26012606
* Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success.
26022607
* @see https://core.telegram.org/bots/api#sendgift
26032608
*/
2604-
async sendGift(options: {
2605-
user_id: number;
2606-
gift_id: string;
2607-
pay_for_upgrade?: boolean;
2608-
text?: string;
2609-
text_parse_mode?: ParseMode;
2610-
text_entities?: MessageEntity[];
2611-
}): Promise<true> {
2609+
2610+
async sendGift(
2611+
options: ExactlyOne<{
2612+
user_id?: number;
2613+
chat_id?: number | string;
2614+
}> & {
2615+
gift_id: string;
2616+
pay_for_upgrade?: boolean;
2617+
text?: string;
2618+
text_parse_mode?: ParseMode;
2619+
text_entities?: MessageEntity[];
2620+
},
2621+
): Promise<true> {
26122622
return await this.callApi('sendGift', {
26132623
...options,
26142624
text_entities: new JSONSerialized(options.text_entities),

src/types/ChatFullInfo.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ export type ChatFullInfo = {
180180
*/
181181
permissions?: ChatPermissions;
182182

183+
/**
184+
* Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only
185+
* for channel chats.
186+
*/
187+
can_send_gift?: true;
188+
183189
/**
184190
* Optional. True, if paid media messages can be sent or forwarded to the channel chat. The field is available only
185191
* for channel chats.

src/types/InlineQueryResultsButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { WebAppInfo } from './';
2-
import { AtMostOne } from './Update';
2+
import { AtMostOne } from '../utils';
33

44
/**
55
* ## InlineQueryResultsButton

src/types/InputMediaVideo.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ export type InputMediaVideo = {
2626
*/
2727
thumbnail?: InputFile | string;
2828

29+
/**
30+
* Optional. Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers
31+
* (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>”
32+
* to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files](https://core.telegram.org/bots/api#sending-files)
33+
*/
34+
cover?: InputFile | string;
35+
36+
/**
37+
* Optional. Start timestamp for the video in the message
38+
*/
39+
start_timestamp?: number;
40+
2941
/**
3042
* Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
3143
*/

src/types/InputPaidMediaVideo.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ export type InputPaidMediaVideo = {
3030
*/
3131
thumbnail?: InputFile | string;
3232

33+
/**
34+
* Optional. Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers
35+
* (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>”
36+
* to upload a new one using multipart/form-data under <file_attach_name> name. [More information on Sending Files](https://core.telegram.org/bots/api#sending-files)
37+
*/
38+
cover?: InputFile | string;
39+
40+
/**
41+
* Optional. Start timestamp for the video in the message
42+
*/
43+
start_timestamp?: number;
44+
3345
/**
3446
* Optional. Video width
3547
*/

src/types/KeyboardButton.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { WebAppInfo, KeyboardButtonRequestChat, KeyboardButtonPollType, KeyboardButtonRequestUsers } from './';
2-
import { AtMostOne } from './Update';
2+
import { AtMostOne } from '../utils';
33

44
/**
55
* ## KeyboardButton

src/types/TransactionPartner.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
TransactionPartnerFragment,
33
TransactionPartnerUser,
4+
TransactionPartnerChat,
45
TransactionPartnerTelegramAds,
56
TransactionPartnerTelegramApi,
67
TransactionPartnerOther,
@@ -12,6 +13,7 @@ import {
1213
* This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be
1314
* one of
1415
* - TransactionPartnerUser
16+
* - TransactionPartnerChat
1517
* - TransactionPartnerAffiliateProgram
1618
* - TransactionPartnerFragment
1719
* - TransactionPartnerTelegramAds
@@ -21,6 +23,7 @@ import {
2123
*/
2224
export type TransactionPartner =
2325
| TransactionPartnerUser
26+
| TransactionPartnerChat
2427
| TransactionPartnerAffiliateProgram
2528
| TransactionPartnerFragment
2629
| TransactionPartnerTelegramAds
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Chat, Gift } from './';
2+
3+
/**
4+
* Describes a transaction with a chat.
5+
*/
6+
export type TransactionPartnerChat = {
7+
/**
8+
* Type of the transaction partner, always “chat”
9+
*/
10+
type: 'chat';
11+
12+
/**
13+
* Information about the chat
14+
*/
15+
chat: Chat;
16+
17+
/**
18+
* Optional. The gift sent to the chat by the bot
19+
*/
20+
gift?: Gift;
21+
};

0 commit comments

Comments
 (0)