mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 13:27:44 +00:00
sendlocation
This commit is contained in:
parent
bb29db717e
commit
e47fbc622e
@ -376,4 +376,23 @@ TelegramBot.prototype.sendChatAction = function (chatId, action) {
|
||||
return this._request('sendChatAction', {qs: query});
|
||||
};
|
||||
|
||||
/**
|
||||
* Send location.
|
||||
* Use this method to send point on the map.
|
||||
*
|
||||
* @param {Number|String} chatId Unique identifier for the message recipient
|
||||
* @param {Float} latitude Latitude of location
|
||||
* @param {Float} longitude Longitude of location
|
||||
* @return {Promise}
|
||||
* @see https://core.telegram.org/bots/api#sendlocation
|
||||
*/
|
||||
TelegramBot.prototype.sendLocation = function (chatId, latitude, longitude) {
|
||||
var query = {
|
||||
chat_id: chatId,
|
||||
latitude: latitude,
|
||||
longitude: longitude
|
||||
};
|
||||
return this._request('sendLocation', {qs: query});
|
||||
};
|
||||
|
||||
module.exports = TelegramBot;
|
||||
|
@ -322,4 +322,19 @@ describe('Telegram', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#sendLocation', function () {
|
||||
it('should send a location', function (done) {
|
||||
var bot = new Telegram(TOKEN);
|
||||
var lat = 47.5351072;
|
||||
var long = -52.7508537;
|
||||
bot.sendLocation(USERID, lat, long).then(function (resp) {
|
||||
resp.should.be.an.instanceOf(Object);
|
||||
resp.location.should.be.an.instanceOf(Object);
|
||||
resp.location.latitude.should.be.an.instanceOf(Number);
|
||||
resp.location.longitude.should.be.an.instanceOf(Number);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user