From c5f97ce524e53f7cc5d5118b5632dbee4e08b1cf Mon Sep 17 00:00:00 2001 From: Yago Date: Sun, 13 Mar 2016 11:25:36 +0100 Subject: [PATCH] Bind getFile response in getFileLink --- src/telegram.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/telegram.js b/src/telegram.js index 8f13bed..ee653b8 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -515,16 +515,14 @@ TelegramBot.prototype.getFile = function(fileId) { * @see https://core.telegram.org/bots/api#getfile */ TelegramBot.prototype.getFileLink = function(fileId) { - - var self = this; - return self.getFile(fileId).then(function (resp) { - return URL.format({ - protocol: 'https', - host: 'api.telegram.org', - pathname: '/file/bot' + self.token + '/' + resp.file_path - }); - }); - + return this.getFile(fileId) + .then(function (resp) { + return URL.format({ + protocol: 'https', + host: 'api.telegram.org', + pathname: '/file/bot' + this.token + '/' + resp.file_path + }); + }.bind(this)); }; /**