mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-28 12:57:38 +00:00
Add SendDocument Method
Add SendDocument Method
This commit is contained in:
parent
013d680a25
commit
c2d4ec145a
@ -295,6 +295,26 @@ TelegramBot.prototype.sendAudio = function (chatId, audio, options) {
|
||||
return this._request('sendAudio', opts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Send Document
|
||||
* @param {Number|String} chatId Unique identifier for the message recipient
|
||||
* @param {String|stream.Stream} A file path or a Stream. Can
|
||||
* also be a `file_id` previously uploaded.
|
||||
* @param {Object} [options] Additional Telegram query options
|
||||
* @return {Promise}
|
||||
* @see https://core.telegram.org/bots/api#sendDocument
|
||||
*/
|
||||
TelegramBot.prototype.sendDocument = function (chatId, doc, options) {
|
||||
var opts = {
|
||||
qs: options || {}
|
||||
};
|
||||
opts.qs.chat_id = chatId;
|
||||
var content = this._formatSendData('document', doc);
|
||||
opts.formData = content[0];
|
||||
opts.qs.document = content[1];
|
||||
return this._request('sendDocument', opts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Send chat action.
|
||||
* `typing` for text messages,
|
||||
|
Loading…
x
Reference in New Issue
Block a user