Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/telegrambot.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ TelegramBot.unwrap = function(cb) {
// by passing the error object as the first parameter.
if (!err && body && body.ok === false) err = TelegramBot.error(body.description, body.error_code, res.statusCode);
if (!err && res.statusCode != 200) err = TelegramBot.error('HTTP status ' + res.statusCode + ' returned.', res.statusCode, res.statusCode);
if (err) return cb.apply(self, [err]);

cb.apply(self, [null, body.result]);
if(cb!=null && cb!=undefined){
if (err) return cb.apply(self, [err]);
cb.apply(self, [null, body.result]);
}
}
}

Expand Down