diff --git a/CHANGELOG.md b/CHANGELOG.md index e249f00..73a2a72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Added: 1. Add Bot API v3.4 methods: * (#439) *TelegramBot#editMessageLiveLocation*, *TelegramBot#stopMessageLiveLocation* (by @kamikazechaser) + * (#440) *TelegramBot#setChatStickerSet*, *TelegramBot#deleteChatStickerSet* (by @kamikazechaser) 1. Add `metadata` argument in `message` event (and friends e.g. `text`, `audio`, etc.) (#409) (by @jlsjonas, @GochoMugo) 1. Add support for Node.js v9 (by @GochoMugo) diff --git a/doc/api.md b/doc/api.md index 9a6bd81..610d472 100644 --- a/doc/api.md +++ b/doc/api.md @@ -71,6 +71,8 @@ TelegramBot * [.getChatMembersCount(chatId)](#TelegramBot+getChatMembersCount) ⇒ Promise * [.getChatMember(chatId, userId)](#TelegramBot+getChatMember) ⇒ Promise * [.leaveChat(chatId)](#TelegramBot+leaveChat) ⇒ Promise + * [.setChatStickerSet(chatId, stickerSetName)](#TelegramBot+setChatStickerSet) ⇒ Promise + * [.deleteChatStickerSet(chatId)](#TelegramBot+deleteChatStickerSet) ⇒ Promise * [.sendGame(chatId, gameShortName, [options])](#TelegramBot+sendGame) ⇒ Promise * [.setGameScore(userId, score, [options])](#TelegramBot+setGameScore) ⇒ Promise * [.getGameHighScores(userId, [options])](#TelegramBot+getGameHighScores) ⇒ Promise @@ -935,6 +937,31 @@ Leave a group, supergroup or channel. | --- | --- | --- | | chatId | Number | String | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) | + + +### telegramBot.setChatStickerSet(chatId, stickerSetName) ⇒ Promise +Use this method to set a new group sticker set for a supergroup. + +**Kind**: instance method of [TelegramBot](#TelegramBot) +**See**: https://core.telegram.org/bots/api#setchatstickerset + +| Param | Type | Description | +| --- | --- | --- | +| chatId | Number | String | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) | +| stickerSetName | String | Name of the sticker set to be set as the group sticker set | + + + +### telegramBot.deleteChatStickerSet(chatId) ⇒ Promise +Use this method to delete a group sticker set from a supergroup. + +**Kind**: instance method of [TelegramBot](#TelegramBot) +**See**: https://core.telegram.org/bots/api#deletechatstickerset + +| Param | Type | Description | +| --- | --- | --- | +| chatId | Number | String | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) | + ### telegramBot.sendGame(chatId, gameShortName, [options]) ⇒ Promise diff --git a/src/telegram.js b/src/telegram.js index a5cb770..7d0d441 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -1448,6 +1448,34 @@ class TelegramBot extends EventEmitter { return this._request('leaveChat', { form }); } + /** + * Use this method to set a new group sticker set for a supergroup. + * @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) + * @param {String} stickerSetName Name of the sticker set to be set as the group sticker set + * @return {Promise} + * @see https://core.telegram.org/bots/api#setchatstickerset + */ + setChatStickerSet(chatId, stickerSetName) { + const form = { + chat_id: chatId, + sticker_set_name: stickerSetName + }; + return this._request('setChatStickerSet', { form }); + } + + /** + * Use this method to delete a group sticker set from a supergroup. + * @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) + * @return {Promise} + * @see https://core.telegram.org/bots/api#deletechatstickerset + */ + deleteChatStickerSet(chatId) { + const form = { + chat_id: chatId + }; + return this._request('deleteChatStickerSet', { form }); + } + /** * Use this method to send a game. * @param {Number|String} chatId Unique identifier for the message recipient