diff --git a/build/functions/fetch.js b/build/functions/fetch.js index 26e4fc1..d29d59d 100644 --- a/build/functions/fetch.js +++ b/build/functions/fetch.js @@ -47,7 +47,7 @@ function fetch(path) { } _unirest2['default'].post('https://api.telegram.org/bot' + path).field(data).attach(files).end(function (response) { - if (response.statusType === 4 || response.statusType === 5 || !response.body.ok) { + if (response.statusType === 4 || response.statusType === 5 || !response.body || !response.body.ok) { reject(response); } else { resolve(response.body); diff --git a/package.json b/package.json index 032c8da..fbbe1b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "telegram-api", - "version": "0.5.21", + "version": "0.5.22", "description": "Control Telegram bots easily using the new Telegram API", "main": "index.js", "scripts": {