Skip to content

Commit bcffb19

Browse files
committed
update Bot API to 8.2
1 parent 4dd3440 commit bcffb19

File tree

6 files changed

+88
-7
lines changed

6 files changed

+88
-7
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.1-0088cc)](https://core.telegram.org/bots/api#december-4-2024)
7+
[![GitHub](https://img.shields.io/badge/Bot_API-v8.2-0088cc)](https://core.telegram.org/bots/api#january-1-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.6.0",
4+
"version": "0.7.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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,6 +2604,7 @@ export class TelegramBot extends EventEmitter {
26042604
async sendGift(options: {
26052605
user_id: number;
26062606
gift_id: string;
2607+
pay_for_upgrade?: boolean;
26072608
text?: string;
26082609
text_parse_mode?: ParseMode;
26092610
text_entities?: MessageEntity[];
@@ -2614,6 +2615,44 @@ export class TelegramBot extends EventEmitter {
26142615
});
26152616
}
26162617

2618+
/**
2619+
* ## verifyUser
2620+
* Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.
2621+
* @see https://core.telegram.org/bots/api#verifyuser
2622+
*/
2623+
async verifyUser(options: { user_id: number; custom_description?: string }): Promise<true> {
2624+
return await this.callApi('verifyUser', options);
2625+
}
2626+
2627+
/**
2628+
* ## verifyChat
2629+
* Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
2630+
* @see https://core.telegram.org/bots/api#verifychat
2631+
*/
2632+
async verifyChat(options: { chat_id: number | string; custom_description?: string }): Promise<true> {
2633+
return await this.callApi('verifyChat', options);
2634+
}
2635+
2636+
/**
2637+
* ## removeUserVerification
2638+
* Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
2639+
* Returns True on success.
2640+
* @see https://core.telegram.org/bots/api#removeuserverification
2641+
*/
2642+
async removeUserVerification(options: { user_id: number }): Promise<true> {
2643+
return await this.callApi('removeUserVerification', options);
2644+
}
2645+
2646+
/**
2647+
* ## removeChatVerification
2648+
* Removes verification from a chat which is currently verified on behalf of the organization represented by the bot.
2649+
* Returns True on success.
2650+
* @see https://core.telegram.org/bots/api#removechatverification
2651+
*/
2652+
async removeChatVerification(options: { chat_id: number | string }): Promise<true> {
2653+
return await this.callApi('removeChatVerification', options);
2654+
}
2655+
26172656
on<U extends keyof allEmittedTypes>(event: U, listener: (eventData: NonNullable<allEmittedTypes[U]>) => void): this {
26182657
return super.on(event, listener) as this;
26192658
}

src/types/Gift.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ export type Gift = {
2121
*/
2222
star_count: number;
2323

24+
/**
25+
* Optional. The number of Telegram Stars that must be paid to upgrade the gift to a unique one
26+
*/
27+
upgrade_star_count?: number;
28+
2429
/**
2530
* Optional. The total number of the gifts of this type that can be sent; for limited gifts only
2631
*/

src/types/InlineQueryResultArticle.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ export type InlineQueryResultArticle = {
3636
*/
3737
url?: string;
3838

39-
/**
40-
* Optional. Pass True if you don't want the URL to be shown in the message
41-
*/
42-
hide_url?: boolean;
43-
4439
/**
4540
* Optional. Short description of the result
4641
*/

tests/index.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,3 +2430,45 @@ describe('.sendGift()', () => {
24302430
).rejects.toThrow('400 Bad Request: BALANCE_TOO_LOW');
24312431
});
24322432
});
2433+
2434+
describe('.verifyUser()', () => {
2435+
test('should verify user', async () => {
2436+
await expect(
2437+
bot.verifyUser({
2438+
user_id: USERID,
2439+
custom_description: 'description',
2440+
}),
2441+
).rejects.toThrow('400 Bad Request: BOT_VERIFIER_FORBIDDEN');
2442+
});
2443+
});
2444+
2445+
describe('.verifyChat()', () => {
2446+
test('should verify chat', async () => {
2447+
await expect(
2448+
bot.verifyChat({
2449+
chat_id: USERID,
2450+
custom_description: 'description',
2451+
}),
2452+
).rejects.toThrow('400 Bad Request: BOT_VERIFIER_FORBIDDEN');
2453+
});
2454+
});
2455+
2456+
describe('.removeUserVerification()', () => {
2457+
test('should remove user verification', async () => {
2458+
await expect(
2459+
bot.removeUserVerification({
2460+
user_id: USERID,
2461+
}),
2462+
).rejects.toThrow('400 Bad Request: BOT_VERIFIER_FORBIDDEN');
2463+
});
2464+
});
2465+
2466+
describe('.removeChatVerification()', () => {
2467+
test('should remove chat verification', async () => {
2468+
await expect(
2469+
bot.removeChatVerification({
2470+
chat_id: USERID,
2471+
}),
2472+
).rejects.toThrow('400 Bad Request: BOT_VERIFIER_FORBIDDEN');
2473+
});
2474+
});

0 commit comments

Comments
 (0)