mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 13:27:44 +00:00
Add sendAnimation method
Reference: Telegram API Documentation: https://core.telegram.org/bots/api#sendanimation
This commit is contained in:
parent
2d3421905c
commit
8b99ccb75c
@ -838,6 +838,32 @@ class TelegramBot extends EventEmitter {
|
||||
return this._request('sendVideo', opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
|
||||
* @param {Number|String} chatId Unique identifier for the message recipient
|
||||
* @param {String|stream.Stream|Buffer} doc A file path, Stream or Buffer.
|
||||
* Can also be a `file_id` previously uploaded.
|
||||
* @param {Object} [options] Additional Telegram query options
|
||||
* @param {Object} [fileOptions] Optional file related meta-data
|
||||
* @return {Promise}
|
||||
* @see https://core.telegram.org/bots/api#sendanimation
|
||||
* @see https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files
|
||||
*/
|
||||
sendAnimation(chatId, animation, options = {}, fileOptions = {}) {
|
||||
const opts = {
|
||||
qs: options
|
||||
};
|
||||
opts.qs.chat_id = chatId;
|
||||
try {
|
||||
const sendData = this._formatSendData('animation', animation, fileOptions);
|
||||
opts.formData = sendData[0];
|
||||
opts.qs.document = sendData[1];
|
||||
} catch (ex) {
|
||||
return Promise.reject(ex);
|
||||
}
|
||||
return this._request('sendAnimation', opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to send rounded square videos of upto 1 minute long.
|
||||
* @param {Number|String} chatId Unique identifier for the message recipient
|
||||
|
Loading…
x
Reference in New Issue
Block a user