|
|
|
@ -76,7 +76,7 @@ TelegramBot.prototype._configureWebHook = function (port, key, cert) { |
|
|
|
|
|
|
|
|
|
|
|
TelegramBot.prototype._requestListener = function (req, res) { |
|
|
|
TelegramBot.prototype._requestListener = function (req, res) { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
if (req.url == '/bot' && req.method == 'POST') { |
|
|
|
if (req.url === '/bot' && req.method === 'POST') { |
|
|
|
var fullBody = ''; |
|
|
|
var fullBody = ''; |
|
|
|
req.on('data', function (chunk) { |
|
|
|
req.on('data', function (chunk) { |
|
|
|
fullBody += chunk.toString(); |
|
|
|
fullBody += chunk.toString(); |
|
|
|
@ -124,7 +124,7 @@ TelegramBot.prototype._request = function (path, options) { |
|
|
|
|
|
|
|
|
|
|
|
return requestPromise(options) |
|
|
|
return requestPromise(options) |
|
|
|
.then(function (resp) { |
|
|
|
.then(function (resp) { |
|
|
|
if (resp[0].statusCode != 200) { |
|
|
|
if (resp[0].statusCode !== 200) { |
|
|
|
throw new Error(resp[0].statusCode+' '+resp[0].body); |
|
|
|
throw new Error(resp[0].statusCode+' '+resp[0].body); |
|
|
|
} |
|
|
|
} |
|
|
|
var data = JSON.parse(resp[0].body); |
|
|
|
var data = JSON.parse(resp[0].body); |
|
|
|
|