2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-22 09:57:10 +00:00

setStickerSetThumb function added

https://core.telegram.org/bots/api#setstickersetthumb

Now you can add thumb image to the sticker set
This commit is contained in:
elihaidv 2020-12-28 18:47:38 +02:00 committed by GitHub
parent 28cd62e355
commit 7738677b45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2045,6 +2045,38 @@ class TelegramBot extends EventEmitter {
}
return this._request('addStickerToSet', opts);
}
/**
* Use this method to add a thumb to a set created by the bot.
* Returns True on success.
*
* @param {Number} userId User identifier of sticker set owner
* @param {String} name Sticker set name
* @param {String|stream.Stream|Buffer} pngThumb A PNG image with the thumbnail,
* must be up to 128 kilobytes in size and have width and height exactly 100px,
* or a TGS animation with the thumbnail up to 32 kilobytes in size;
* @param {Object} [options] Additional Telegram query options
* @param {Object} [fileOptions] Optional file related meta-data
* @return {Promise}
* @see https://core.telegram.org/bots/api#setstickersetthumb
* @todo Add tests for this method!
*/
setStickerSetThumb(userId, name, pngThumb, options = {}, fileOptions = {}) {
const opts = {
qs: options,
};
opts.qs.user_id = userId;
opts.qs.name = name;
opts.qs.mask_position = stringify(options.mask_position);
try {
const sendData = this._formatSendData('thumb', pngThumb, fileOptions);
opts.formData = sendData[0];
opts.qs.thumb = sendData[1];
} catch (ex) {
return Promise.reject(ex);
}
return this._request('setStickerSetThumb', opts);
}
/**
* Use this method to move a sticker in a set created by the bot to a specific position.