Skip to content

Commit

Permalink
feat: Telegram Bot API 6.8 support (#1113)
Browse files Browse the repository at this point in the history
* feat: Telegram Bot API 6.8 support

* chore: telegramWebHook file format
  • Loading branch information
danielperez9430 committed Aug 22, 2023
1 parent dfe24a4 commit 595cdbd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Expand Up @@ -3,9 +3,13 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.63.0][0.61.0] - 2023-08-23
1. Support Telegram Bot API v6.8 (@danielperez9430)
* unpinAllGeneralForumTopicMessages

## [0.62.0][0.62.0] - 2023-03-19

1. Support Telegram Bot API v6.6 (@danielperez9430)
1. Support Telegram Bot API v6.6 & v6.7 (@danielperez9430)
* setMyDescription
* getMyDescription
* setMyShortDescription
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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.6.3-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)
[![Bot API](https://img.shields.io/badge/Bot%20API-v.6.8-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)
[![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)
[![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)
Expand Down
18 changes: 17 additions & 1 deletion doc/api.md
Expand Up @@ -99,6 +99,7 @@ TelegramBot
* [.reopenGeneralForumTopic(chatId, [options])](#TelegramBot+reopenGeneralForumTopic) ⇒ <code>Promise</code>
* [.hideGeneralForumTopic(chatId, [options])](#TelegramBot+hideGeneralForumTopic) ⇒ <code>Promise</code>
* [.unhideGeneralForumTopic(chatId, [options])](#TelegramBot+unhideGeneralForumTopic) ⇒ <code>Promise</code>
* [.unpinAllGeneralForumTopicMessages(chatId, [options])](#TelegramBot+unpinAllGeneralForumTopicMessages) ⇒ <code>Promise</code>
* [.answerCallbackQuery(callbackQueryId, [options])](#TelegramBot+answerCallbackQuery) ⇒ <code>Promise</code>
* [.setMyCommands(commands, [options])](#TelegramBot+setMyCommands) ⇒ <code>Promise</code>
* [.deleteMyCommands([options])](#TelegramBot+deleteMyCommands) ⇒ <code>Promise</code>
Expand Down Expand Up @@ -440,7 +441,7 @@ that is being deprecated.
| url | <code>String</code> | URL where Telegram will make HTTP Post. Leave empty to delete webHook. |
| [options] | <code>Object</code> | Additional Telegram query options |
| [options.certificate] | <code>String</code> \| <code>stream.Stream</code> | PEM certificate key (public). |
| [options.secret_token] | <code>String</code> | A secret token to be sent in a header `X-Telegram-Bot-Api-Secret-Token` in every webhook request. |
| [options.secret_token] | <code>String</code> | Optional secret token to be sent in a header `X-Telegram-Bot-Api-Secret-Token` in every webhook request. |
| [fileOptions] | <code>Object</code> | Optional file related meta-data |

<a name="TelegramBot+deleteWebHook"></a>
Expand Down Expand Up @@ -1581,6 +1582,21 @@ The bot must be an administrator in the chat for this to work and must have the
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) |
| [options] | <code>Object</code> | Additional Telegram query options |

<a name="TelegramBot+unpinAllGeneralForumTopicMessages"></a>

### telegramBot.unpinAllGeneralForumTopicMessages(chatId, [options]) ⇒ <code>Promise</code>
Use this method to clear the list of pinned messages in a General forum topic.
The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup.

**Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot)
**Returns**: <code>Promise</code> - True on success
**See**: https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages

| Param | Type | Description |
| --- | --- | --- |
| chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) |
| [options] | <code>Object</code> | Additional Telegram query options |

<a name="TelegramBot+answerCallbackQuery"></a>

### telegramBot.answerCallbackQuery(callbackQueryId, [options]) ⇒ <code>Promise</code>
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "node-telegram-bot-api",
"version": "0.61.0",
"version": "0.63.0",
"description": "Telegram Bot API",
"main": "./index.js",
"directories": {
Expand Down
14 changes: 14 additions & 0 deletions src/telegram.js
Expand Up @@ -2069,6 +2069,20 @@ class TelegramBot extends EventEmitter {
return this._request('unhideGeneralForumTopic', { form });
}

/**
* Use this method to clear the list of pinned messages in a General forum topic.
* The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup.
*
* @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)
* @param {Object} [options] Additional Telegram query options
* @return {Promise} True on success
* @see https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
*/
unpinAllGeneralForumTopicMessages(chatId, form = {}) {
form.chat_id = chatId;
return this._request('unhideGeneralForumTopic', { form });
}

/**
* Use this method to send answers to callback queries sent from
* [inline keyboards](https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating).
Expand Down
2 changes: 1 addition & 1 deletion src/telegramWebHook.js
Expand Up @@ -45,7 +45,7 @@ class TelegramBotWebHook {
/**
* Open WebHook by listening on the port
* @return {Promise}
*/
*/
open() {
if (this.isOpen()) {
return Promise.resolve();
Expand Down

0 comments on commit 595cdbd

Please sign in to comment.