2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-30 13:58:27 +00:00

feat: Telegram Bot API 6.4

This commit is contained in:
Daniel
2022-12-30 18:49:46 +01:00
parent 4ef4fe9ba9
commit dfefcb7fee
3 changed files with 90 additions and 7 deletions

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## [0.61.0][0.61.0] - 2022-12-30
1. Support Telegram Bot API v6.4 (@danielperez9430)
* editGeneralForumTopic
* closeGeneralForumTopic
* reopenGeneralForumTopic
* hideGeneralForumTopic
* unhideGeneralForumTopic
2. Minor changes:
* The parameters `name` and `icon_custom_emoji_id` of the method `editForumTopic` are now optional.
## [0.60.0][0.60.0] - 2022-10-06 ## [0.60.0][0.60.0] - 2022-10-06
1. Support Telegram Bot API v6.3 (@danielperez9430) 1. Support Telegram Bot API v6.3 (@danielperez9430)

View File

@@ -1,6 +1,6 @@
{ {
"name": "node-telegram-bot-api", "name": "node-telegram-bot-api",
"version": "0.60.0", "version": "0.61.0",
"description": "Telegram Bot API", "description": "Telegram Bot API",
"main": "./index.js", "main": "./index.js",
"directories": { "directories": {
@@ -71,4 +71,4 @@
"url": "https://github.com/yagop/node-telegram-bot-api/issues" "url": "https://github.com/yagop/node-telegram-bot-api/issues"
}, },
"homepage": "https://github.com/yagop/node-telegram-bot-api" "homepage": "https://github.com/yagop/node-telegram-bot-api"
} }

View File

@@ -1916,17 +1916,13 @@ class TelegramBot extends EventEmitter {
* *
* @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) * @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)
* @param {Number} messageThreadId Unique identifier for the target message thread of the forum topic * @param {Number} messageThreadId Unique identifier for the target message thread of the forum topic
* @param {String} name New topic name, 1-128 characters
* @param {String} iconCustomEmojiId New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers
* @param {Object} [options] Additional Telegram query options * @param {Object} [options] Additional Telegram query options
* @return {Promise} True on success * @return {Promise} True on success
* @see https://core.telegram.org/bots/api#editforumtopic * @see https://core.telegram.org/bots/api#editforumtopic
*/ */
editForumTopic(chatId, messageThreadId, name, iconCustomEmojiId, form = {}) { editForumTopic(chatId, messageThreadId, form = {}) {
form.chat_id = chatId; form.chat_id = chatId;
form.message_thread_id = messageThreadId; form.message_thread_id = messageThreadId;
form.name = name;
form.icon_custom_emoji_id = iconCustomEmojiId;
return this._request('editForumTopic', { form }); return this._request('editForumTopic', { form });
} }
@@ -1994,6 +1990,81 @@ class TelegramBot extends EventEmitter {
return this._request('unpinAllForumTopicMessages', { form }); return this._request('unpinAllForumTopicMessages', { form });
} }
/**
* Use this method to edit the name of the 'General' topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
* The topic will be automatically unhidden if it was hidden.
*
* @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)
* @param {String} name New topic name, 1-128 characters
* @param {Object} [options] Additional Telegram query options
* @return {Promise} True on success
* @see https://core.telegram.org/bots/api#editgeneralforumtopic
*/
editGeneralForumTopic(chatId, name, form = {}) {
form.chat_id = chatId;
form.name = name;
return this._request('editGeneralForumTopic', { form });
}
/**
* Use this method to close an open 'General' topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
* The topic will be automatically unhidden if it was hidden.
*
* @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#closegeneralforumtopic
*/
closeGeneralForumTopic(chatId, form = {}) {
form.chat_id = chatId;
return this._request('closeGeneralForumTopic', { form });
}
/**
* Use this method to reopen a closed 'General' topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
* The topic will be automatically unhidden if it was hidden.
*
* @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#reopengeneralforumtopic
*/
reopenGeneralForumTopic(chatId, form = {}) {
form.chat_id = chatId;
return this._request('reopenGeneralForumTopic', { form });
}
/**
* Use this method to hide the 'General' topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights.
* The topic will be automatically closed if it was open.
*
* @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#hidegeneralforumtopic
*/
hideGeneralForumTopic(chatId, form = {}) {
form.chat_id = chatId;
return this._request('hideGeneralForumTopic', { form });
}
/**
* Use this method to unhide the 'General' topic in a forum supergroup chat.
* The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights
*
* @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#unhidegeneralforumtopic
*/
unhideGeneralForumTopic(chatId, form = {}) {
form.chat_id = chatId;
return this._request('unhideGeneralForumTopic', { form });
}
/** /**
* Use this method to send answers to callback queries sent from * Use this method to send answers to callback queries sent from