2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-22 18:07:16 +00:00

feat: Bot API v8.3

This commit is contained in:
danielperez9430 2025-04-16 15:48:03 +02:00
parent b4effe6980
commit 0b2662fd24
4 changed files with 112 additions and 2 deletions

View File

@ -18,6 +18,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* getAvailableGifts (@danielperez9430)
* sendGift (@danielperez9430)
4. Support Telegram Bot API 8.2 and 8.3 (@danielperez9430)
* verifyUser
* verifyChat
* removeUserVerification
* removeChatVerification
## [0.67.0][0.67.0] - 2024-05-30
1. Support Telegram Bot API 7.4 (@danielperez9430)

View File

@ -5,7 +5,7 @@
Node.js module to interact with the official [Telegram Bot API](https://core.telegram.org/bots/api).
[![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)
[![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)
[![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)
[![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)

View File

@ -161,6 +161,10 @@ TelegramBot
* [.deleteMessages(chatId, messageIds, [options])](#TelegramBot+deleteMessages) ⇒ <code>[ &#x27;Promise&#x27; ].&lt;Boolean&gt;</code>
* [.getAvailableGifts([options])](#TelegramBot+getAvailableGifts) ⇒ <code>Promise</code>
* [.sendGift(giftId, [options])](#TelegramBot+sendGift) ⇒ <code>Promise</code>
* [.verifyUser(userId)](#TelegramBot+verifyUser) ⇒ <code>Promise</code>
* [.verifyChat(chatId)](#TelegramBot+verifyChat) ⇒ <code>Promise</code>
* [.removeUserVerification(userId)](#TelegramBot+removeUserVerification) ⇒ <code>Promise</code>
* [.removeChatVerification(chatId)](#TelegramBot+removeChatVerification) ⇒ <code>Promise</code>
* _static_
* [.errors](#TelegramBot.errors) : <code>Object</code>
* [.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.
| giftId | <code>String</code> | Unique identifier of the gift |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+verifyUser"></a>
### telegramBot.verifyUser(userId) ⇒ <code>Promise</code>
This method verifies a user [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - On success, returns true.
**See**: https://core.telegram.org/bots/api#verifyuser
| Param | Type | Description |
| --- | --- | --- |
| userId | <code>Number</code> | Unique identifier of the target user |
<a name="TelegramBot+verifyChat"></a>
### telegramBot.verifyChat(chatId) ⇒ <code>Promise</code>
This method verifies a chat [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - On success, returns true.
**See**: https://core.telegram.org/bots/api#verifychat
| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> | Unique identifier of the target chat |
<a name="TelegramBot+removeUserVerification"></a>
### telegramBot.removeUserVerification(userId) ⇒ <code>Promise</code>
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.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - On success, returns true.
**See**: https://core.telegram.org/bots/api#removeuserverification
| Param | Type | Description |
| --- | --- | --- |
| userId | <code>Number</code> | Unique identifier of the target user |
<a name="TelegramBot+removeChatVerification"></a>
### telegramBot.removeChatVerification(chatId) ⇒ <code>Promise</code>
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.
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - On success, returns true.
**See**: https://core.telegram.org/bots/api#removechatverification
| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> | Unique identifier of the target chat |
<a name="TelegramBot.errors"></a>
### TelegramBot.errors : <code>Object</code>

View File

@ -3356,7 +3356,55 @@ class TelegramBot extends EventEmitter {
*/
sendGift(giftId, form = {}) {
form.gift_id = giftId;
return this._request('getAvailableGifts', { form });
return this._request('sendGift', { form });
}
/**
* This method verifies a user [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
*
* @param {Number} userId Unique identifier of the target user
* @return {Promise} On success, returns true.
* @see https://core.telegram.org/bots/api#verifyuser
*/
verifyUser(userId, form = {}) {
form.user_id = userId;
return this._request('verifyUser', { form });
}
/**
* This method verifies a chat [on behalf of the organization](https://telegram.org/verify#third-party-verification) which is represented by the bot.
*
* @param {Number} chatId Unique identifier of the target chat
* @return {Promise} On success, returns true.
* @see https://core.telegram.org/bots/api#verifychat
*/
verifyChat(chatId, form = {}) {
form.chat_id = chatId;
return this._request('verifyChat', { form });
}
/**
* 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.
*
* @param {Number} userId Unique identifier of the target user
* @return {Promise} On success, returns true.
* @see https://core.telegram.org/bots/api#removeuserverification
*/
removeUserVerification(userId, form = {}) {
form.user_id = userId;
return this._request('removeUserVerification', { form });
}
/**
* 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.
*
* @param {Number} chatId Unique identifier of the target chat
* @return {Promise} On success, returns true.
* @see https://core.telegram.org/bots/api#removechatverification
*/
removeChatVerification(chatId, form = {}) {
form.chat_id = chatId;
return this._request('removeChatVerification', { form });
}
}