Skip to content

Commit 65ef0a2

Browse files
feat: Support Telegram Bot API 7.3
1 parent fea59f4 commit 65ef0a2

File tree

4 files changed

+84
-11
lines changed

4 files changed

+84
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [0.66.0][0.66.0] - 2024-05-03
88

9-
1. Support Telegram Bot API 7.2 (@danielperez9430)
9+
1. Support Telegram Bot API 7.2 & 7.3 (@danielperez9430)
1010
* getBusinessConnection
1111
* replaceStickerInSet
1212

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.7.2-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
8+
[![Bot API](https://img.shields.io/badge/Bot%20API-v.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
[![Build Status](https://img.shields.io/travis/yagop/node-telegram-bot-api/master?style=flat-square&logo=travis)](https://travis-ci.org/yagop/node-telegram-bot-api)
1111
[![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)

doc/api.md

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ TelegramBot
4040
* [.close([options])](#TelegramBot+close) ⇒ <code>Promise</code>
4141
* [.sendMessage(chatId, text, [options])](#TelegramBot+sendMessage) ⇒ <code>Promise</code>
4242
* [.forwardMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+forwardMessage) ⇒ <code>Promise</code>
43+
* [.forwardMessages(chatId, fromChatId, messageIds, [options])](#TelegramBot+forwardMessages) ⇒ <code>Promise</code>
4344
* [.copyMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+copyMessage) ⇒ <code>Promise</code>
4445
* [.copyMessages(chatId, fromChatId, messageIds, [options])](#TelegramBot+copyMessages) ⇒ <code>Promise</code>
4546
* [.sendPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code>
@@ -103,6 +104,8 @@ TelegramBot
103104
* [.unhideGeneralForumTopic(chatId, [options])](#TelegramBot+unhideGeneralForumTopic) ⇒ <code>Promise</code>
104105
* [.unpinAllGeneralForumTopicMessages(chatId, [options])](#TelegramBot+unpinAllGeneralForumTopicMessages) ⇒ <code>Promise</code>
105106
* [.answerCallbackQuery(callbackQueryId, [options])](#TelegramBot+answerCallbackQuery) ⇒ <code>Promise</code>
107+
* [.getUserChatBoosts(chatId, user_id, [options])](#TelegramBot+getUserChatBoosts) ⇒ <code>Promise</code>
108+
* [.getBusinessConnection(businessConnectionId, [options])](#TelegramBot+getBusinessConnection) ⇒ <code>Promise</code>
106109
* [.setMyCommands(commands, [options])](#TelegramBot+setMyCommands) ⇒ <code>Promise</code>
107110
* [.deleteMyCommands([options])](#TelegramBot+deleteMyCommands) ⇒ <code>Promise</code>
108111
* [.getMyCommands([options])](#TelegramBot+getMyCommands) ⇒ <code>Promise</code>
@@ -129,6 +132,7 @@ TelegramBot
129132
* [.addStickerToSet(userId, name, sticker, emojis, stickerType, [options], [fileOptions])](#TelegramBot+addStickerToSet) ⇒ <code>Promise</code>
130133
* [.setStickerPositionInSet(sticker, position, [options])](#TelegramBot+setStickerPositionInSet) ⇒ <code>Promise</code>
131134
* [.deleteStickerFromSet(sticker, [options])](#TelegramBot+deleteStickerFromSet) ⇒ <code>Promise</code>
135+
* [.replaceStickerInSet(user_id, name, sticker, [options])](#TelegramBot+replaceStickerInSet) ⇒ <code>Promise</code>
132136
* [.setStickerEmojiList(sticker, emojiList, [options])](#TelegramBot+setStickerEmojiList) ⇒ <code>Promise</code>
133137
* [.setStickerKeywords(sticker, [options])](#TelegramBot+setStickerKeywords) ⇒ <code>Promise</code>
134138
* [.setStickerMaskPosition(sticker, [options])](#TelegramBot+setStickerMaskPosition) ⇒ <code>Promise</code>
@@ -547,6 +551,23 @@ Forward messages of any kind.
547551
| messageId | <code>Number</code> \| <code>String</code> | Unique message identifier in the chat specified in fromChatId |
548552
| [options] | <code>Object</code> | Additional Telegram query options |
549553

554+
<a name="TelegramBot+forwardMessages"></a>
555+
556+
### telegramBot.forwardMessages(chatId, fromChatId, messageIds, [options]) ⇒ <code>Promise</code>
557+
Use this method to forward multiple messages of any kind.
558+
If some of the specified messages can't be found or forwarded, they are skipped.
559+
560+
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
561+
**Returns**: <code>Promise</code> - An array of MessageId of the sent messages on success
562+
**See**: https://core.telegram.org/bots/api#forwardmessages
563+
564+
| Param | Type | Description |
565+
| --- | --- | --- |
566+
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) or username of the target channel (in the format `@channelusername`) |
567+
| fromChatId | <code>Number</code> \| <code>String</code> | Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`) |
568+
| messageIds | <code>[ &#x27;Array&#x27; ].&lt;(Number\|String)&gt;</code> | Identifiers of 1-100 messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order. |
569+
| [options] | <code>Object</code> | Additional Telegram query options |
570+
550571
<a name="TelegramBot+copyMessage"></a>
551572

552573
### telegramBot.copyMessage(chatId, fromChatId, messageId, [options]) ⇒ <code>Promise</code>
@@ -691,7 +712,7 @@ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without s
691712
### telegramBot.sendVoice(chatId, voice, [options], [fileOptions]) ⇒ <code>Promise</code>
692713
Send voice
693714

694-
**Your audio must be in an .OGG file encoded with OPUS** (other formats may be sent as Audio or Document)
715+
**Your audio must be in an .OGG file encoded with OPUS**, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document)
695716

696717
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
697718
**Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned
@@ -912,7 +933,7 @@ Use this method to change the chosen reactions on a message.
912933

913934
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
914935
**Returns**: <code>[ &#x27;Promise&#x27; ].&lt;Boolean&gt;</code> - True on success
915-
**See**: https://core.telegram.org/bots/api#setMessageReaction
936+
**See**: https://core.telegram.org/bots/api#setmessagereaction
916937

917938
| Param | Type | Description |
918939
| --- | --- | --- |
@@ -1344,7 +1365,7 @@ Use this method to get up to date information about the chat
13441365
username of a user, group or channel, etc.).
13451366

13461367
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1347-
**Returns**: <code>Promise</code> - [Chat](https://core.telegram.org/bots/api#chat) object on success
1368+
**Returns**: <code>Promise</code> - [ChatFullInfo](https://core.telegram.org/bots/api#chatfullinfo) object on success
13481369
**See**: https://core.telegram.org/bots/api#getchat
13491370

13501371
| Param | Type | Description |
@@ -1657,6 +1678,36 @@ that are being deprecated.
16571678
| callbackQueryId | <code>String</code> | Unique identifier for the query to be answered |
16581679
| [options] | <code>Object</code> | Additional Telegram query options |
16591680

1681+
<a name="TelegramBot+getUserChatBoosts"></a>
1682+
1683+
### telegramBot.getUserChatBoosts(chatId, user_id, [options]) ⇒ <code>Promise</code>
1684+
Use this method to get the list of boosts added to a chat by a use.
1685+
Requires administrator rights in the chat
1686+
1687+
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1688+
**Returns**: <code>Promise</code> - On success, returns a [UserChatBoosts](https://core.telegram.org/bots/api#userchatboosts) object
1689+
**See**: https://core.telegram.org/bots/api#getuserchatboosts
1690+
1691+
| Param | Type | Description |
1692+
| --- | --- | --- |
1693+
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the group/channel |
1694+
| user_id | <code>Number</code> | Unique identifier of the target user |
1695+
| [options] | <code>Object</code> | Additional Telegram query options |
1696+
1697+
<a name="TelegramBot+getBusinessConnection"></a>
1698+
1699+
### telegramBot.getBusinessConnection(businessConnectionId, [options]) ⇒ <code>Promise</code>
1700+
Use this method to get information about the connection of the bot with a business account
1701+
1702+
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
1703+
**Returns**: <code>Promise</code> - On success, returns [BusinessConnection](https://core.telegram.org/bots/api#businessconnection) object
1704+
**See**: https://core.telegram.org/bots/api#getbusinessconnection
1705+
1706+
| Param | Type | Description |
1707+
| --- | --- | --- |
1708+
| businessConnectionId | <code>Number</code> \| <code>String</code> | Unique identifier for the group/channel |
1709+
| [options] | <code>Object</code> | Additional Telegram query options |
1710+
16601711
<a name="TelegramBot+setMyCommands"></a>
16611712

16621713
### telegramBot.setMyCommands(commands, [options]) ⇒ <code>Promise</code>
@@ -2013,9 +2064,11 @@ Use this method to add a new sticker to a set created by the bot.
20132064

20142065
You must use exactly one of the fields *png_sticker*, *tgs_sticker*, or *webm_sticker*
20152066

2016-
Animated stickers can be added to animated sticker sets and only to them:
2017-
- Animated sticker sets can have up to 50 stickers.
2018-
- Static sticker sets can have up to 120 stickers
2067+
Animated stickers can be added to animated sticker sets and only to them
2068+
2069+
Note:
2070+
- Emoji sticker sets can have up to 200 sticker
2071+
- Static or Animated sticker sets can have up to 120 stickers
20192072

20202073
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
20212074
**Returns**: <code>Promise</code> - True on success
@@ -2064,6 +2117,26 @@ Use this method to delete a sticker from a set created by the bot.
20642117
| sticker | <code>String</code> | File identifier of the sticker |
20652118
| [options] | <code>Object</code> | Additional Telegram query options |
20662119

2120+
<a name="TelegramBot+replaceStickerInSet"></a>
2121+
2122+
### telegramBot.replaceStickerInSet(user_id, name, sticker, [options]) ⇒ <code>Promise</code>
2123+
Use this method to replace an existing sticker in a sticker set with a new one
2124+
2125+
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
2126+
**Returns**: <code>Promise</code> - True on success
2127+
**See**: https://core.telegram.org/bots/api#replacestickerinset
2128+
**Todo**
2129+
2130+
- [ ] Add tests for this method!
2131+
2132+
2133+
| Param | Type | Description |
2134+
| --- | --- | --- |
2135+
| user_id | <code>Number</code> | User identifier of the sticker set owner |
2136+
| name | <code>String</code> | Sticker set name |
2137+
| sticker | <code>String</code> | File identifier of the sticker |
2138+
| [options] | <code>Object</code> | Additional Telegram query options |
2139+
20672140
<a name="TelegramBot+setStickerEmojiList"></a>
20682141

20692142
### telegramBot.setStickerEmojiList(sticker, emojiList, [options]) ⇒ <code>Promise</code>
@@ -2366,7 +2439,7 @@ Use this method to delete multiple messages simultaneously. If some of the speci
23662439

23672440
**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
23682441
**Returns**: <code>[ &#x27;Promise&#x27; ].&lt;Boolean&gt;</code> - True on success
2369-
**See**: https://core.telegram.org/bots/api#deleteMessages
2442+
**See**: https://core.telegram.org/bots/api#deletemessages
23702443

23712444
| Param | Type | Description |
23722445
| --- | --- | --- |

src/telegram.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ class TelegramBot extends EventEmitter {
11931193
/**
11941194
* Send voice
11951195
*
1196-
* **Your audio must be in an .OGG file encoded with OPUS** (other formats may be sent as Audio or Document)
1196+
* **Your audio must be in an .OGG file encoded with OPUS**, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document)
11971197
* @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
11981198
* @param {String|stream.Stream|Buffer} voice A file path, Stream or Buffer.
11991199
* Can also be a `file_id` previously uploaded.
@@ -1916,7 +1916,7 @@ class TelegramBot extends EventEmitter {
19161916
* username of a user, group or channel, etc.).
19171917
* @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) or channel
19181918
* @param {Object} [options] Additional Telegram query options
1919-
* @return {Promise} [Chat](https://core.telegram.org/bots/api#chat) object on success
1919+
* @return {Promise} [ChatFullInfo](https://core.telegram.org/bots/api#chatfullinfo) object on success
19201920
* @see https://core.telegram.org/bots/api#getchat
19211921
*/
19221922
getChat(chatId, form = {}) {

0 commit comments

Comments
 (0)