diff --git a/lib/Bot.js b/lib/Bot.js index 7cad17f..33e2284 100644 --- a/lib/Bot.js +++ b/lib/Bot.js @@ -492,6 +492,37 @@ Bot.prototype.sendMessage = function (options, callback) { return deferred.promise.nodeify(callback); }; +// https://tlgrm.ru/docs/bots/api#sendcontact +Bot.prototype.sendContact = function (options, callback) { + var self = this + , deferred = Q.defer(); + + this._get({ + method: 'sendContact', + params: { + chat_id: options.chat_id, + phone_number: options.phone_number, + first_name: options.first_name, + last_name: options.last_name, + disable_notification: options.disable_notification, + reply_to_message_id: options.reply_to_message_id, + reply_markup: JSON.stringify(options.reply_markup) + } + }, function (err, res) { + if (err) { + return deferred.reject(err); + } + + if (res.ok) { + deferred.resolve(res.result); + } else { + deferred.reject(res); + } + }); + + return deferred.promise.nodeify(callback); +}; + /** * Use this method to forward messages of any kind. *