Skip to content

Commit 0b2662f

Browse files
feat: Bot API v8.3
1 parent b4effe6 commit 0b2662f

File tree

4 files changed

+112
-2
lines changed

4 files changed

+112
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1818
* getAvailableGifts (@danielperez9430)
1919
* sendGift (@danielperez9430)
2020

21+
4. Support Telegram Bot API 8.2 and 8.3 (@danielperez9430)
22+
* verifyUser
23+
* verifyChat
24+
* removeUserVerification
25+
* removeChatVerification
26+
2127
## [0.67.0][0.67.0] - 2024-05-30
2228

2329
1. Support Telegram Bot API 7.4 (@danielperez9430)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Node.js module to interact with the official [Telegram Bot API](https://core.telegram.org/bots/api).
66

77

8-
[![Bot API](https://img.shields.io/badge/Bot%20API-v.8.1-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
8+
[![Bot API](https://img.shields.io/badge/Bot%20API-v.8.3-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
99
[![npm package](https://img.shields.io/npm/v/node-telegram-bot-api?logo=npm&style=flat-square)](https://www.npmjs.org/package/node-telegram-bot-api)
1010
[![Coverage Status](https://img.shields.io/codecov/c/github/yagop/node-telegram-bot-api?style=flat-square&logo=codecov)](https://codecov.io/gh/yagop/node-telegram-bot-api)
1111

doc/api.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ TelegramBot
161161
* [.deleteMessages(chatId, messageIds, [options])](#TelegramBot+deleteMessages) ⇒ <code>[ &#x27;Promise&#x27; ].&lt;Boolean&gt;</code>
162162
* [.getAvailableGifts([options])](#TelegramBot+getAvailableGifts) ⇒ <code>Promise</code>
163163
* [.sendGift(giftId, [options])](#TelegramBot+sendGift) ⇒ <code>Promise</code>
164+
* [.verifyUser(userId)](#TelegramBot+verifyUser) ⇒ <code>Promise</code>
165+
* [.verifyChat(chatId)](#TelegramBot+verifyChat) ⇒ <code>Promise</code>
166+
* [.removeUserVerification(userId)](#TelegramBot+removeUserVerification) ⇒ <code>Promise</code>
167+
* [.removeChatVerification(chatId)](#TelegramBot+removeChatVerification) ⇒ <code>Promise</code>
164168
* _static_
165169
* [.errors](#TelegramBot.errors) : <code>Object</code>
166170
* [.messageTypes](#TelegramBot.messageTypes) : <code>[ &#x27;Array&#x27; ].&lt;String&gt;</code>
@@ -2609,6 +2613,58 @@ Use this method to sends a gift to the given user or channel chat.
26092613
| giftId | <code>String</code> | Unique identifier of the gift |
26102614
| [options] | <code>Object</code> | Additional Telegram query options |
26112615

2616+
<a name="TelegramBot+verifyUser"></a>
2617+
2618+
### telegramBot.verifyUser(userId) ⇒ <code>Promise</code>
2619+
This method verifies a user [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
2620+
2621+
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
2622+
**Returns**: <code>Promise</code> - On success, returns true.
2623+
**See**: https://core.telegram.org/bots/api#verifyuser
2624+
2625+
| Param | Type | Description |
2626+
| --- | --- | --- |
2627+
| userId | <code>Number</code> | Unique identifier of the target user |
2628+
2629+
<a name="TelegramBot+verifyChat"></a>
2630+
2631+
### telegramBot.verifyChat(chatId) ⇒ <code>Promise</code>
2632+
This method verifies a chat [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
2633+
2634+
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
2635+
**Returns**: <code>Promise</code> - On success, returns true.
2636+
**See**: https://core.telegram.org/bots/api#verifychat
2637+
2638+
| Param | Type | Description |
2639+
| --- | --- | --- |
2640+
| chatId | <code>Number</code> | Unique identifier of the target chat |
2641+
2642+
<a name="TelegramBot+removeUserVerification"></a>
2643+
2644+
### telegramBot.removeUserVerification(userId) ⇒ <code>Promise</code>
2645+
This method removes verification from a user who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
2646+
2647+
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
2648+
**Returns**: <code>Promise</code> - On success, returns true.
2649+
**See**: https://core.telegram.org/bots/api#removeuserverification
2650+
2651+
| Param | Type | Description |
2652+
| --- | --- | --- |
2653+
| userId | <code>Number</code> | Unique identifier of the target user |
2654+
2655+
<a name="TelegramBot+removeChatVerification"></a>
2656+
2657+
### telegramBot.removeChatVerification(chatId) ⇒ <code>Promise</code>
2658+
This method removes verification from a chat who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
2659+
2660+
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
2661+
**Returns**: <code>Promise</code> - On success, returns true.
2662+
**See**: https://core.telegram.org/bots/api#removechatverification
2663+
2664+
| Param | Type | Description |
2665+
| --- | --- | --- |
2666+
| chatId | <code>Number</code> | Unique identifier of the target chat |
2667+
26122668
<a name="TelegramBot.errors"></a>
26132669

26142670
### TelegramBot.errors : <code>Object</code>

src/telegram.js

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3356,7 +3356,55 @@ class TelegramBot extends EventEmitter {
33563356
*/
33573357
sendGift(giftId, form = {}) {
33583358
form.gift_id = giftId;
3359-
return this._request('getAvailableGifts', { form });
3359+
return this._request('sendGift', { form });
3360+
}
3361+
3362+
/**
3363+
* This method verifies a user [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
3364+
*
3365+
* @param {Number} userId Unique identifier of the target user
3366+
* @return {Promise} On success, returns true.
3367+
* @see https://core.telegram.org/bots/api#verifyuser
3368+
*/
3369+
verifyUser(userId, form = {}) {
3370+
form.user_id = userId;
3371+
return this._request('verifyUser', { form });
3372+
}
3373+
3374+
/**
3375+
* This method verifies a chat [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
3376+
*
3377+
* @param {Number} chatId Unique identifier of the target chat
3378+
* @return {Promise} On success, returns true.
3379+
* @see https://core.telegram.org/bots/api#verifychat
3380+
*/
3381+
verifyChat(chatId, form = {}) {
3382+
form.chat_id = chatId;
3383+
return this._request('verifyChat', { form });
3384+
}
3385+
3386+
/**
3387+
* This method removes verification from a user who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
3388+
*
3389+
* @param {Number} userId Unique identifier of the target user
3390+
* @return {Promise} On success, returns true.
3391+
* @see https://core.telegram.org/bots/api#removeuserverification
3392+
*/
3393+
removeUserVerification(userId, form = {}) {
3394+
form.user_id = userId;
3395+
return this._request('removeUserVerification', { form });
3396+
}
3397+
3398+
/**
3399+
* This method removes verification from a chat who is currently verified [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
3400+
*
3401+
* @param {Number} chatId Unique identifier of the target chat
3402+
* @return {Promise} On success, returns true.
3403+
* @see https://core.telegram.org/bots/api#removechatverification
3404+
*/
3405+
removeChatVerification(chatId, form = {}) {
3406+
form.chat_id = chatId;
3407+
return this._request('removeChatVerification', { form });
33603408
}
33613409

33623410
}

0 commit comments

Comments
 (0)