From 51d5041ac15ca00da62c01ffae8d84f1bf0b8dde Mon Sep 17 00:00:00 2001 From: Cedric Hoelzl Date: Fri, 20 Sep 2019 12:35:13 +0200 Subject: [PATCH] fix --- config.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/config.js b/config.js index 0a43170..8c43056 100644 --- a/config.js +++ b/config.js @@ -32,16 +32,19 @@ module.exports = function(url, cmds){ url: this.url, form:message, }; - return request.get(options, function (err, response, body) { - if (err) - return bot.error(err); + return new Promise((resolve,reject)=>{ + return request.get(options, function (err, response, body) { + if (err) + return reject(500); - if (response.statusCode != 200 ) - return bot.error(response.statusCode); - - return event.reply(body.reply); - - }); + if (response.statusCode != 200 ) + return reject(500);//response.statusCode); + + event.reply(body.reply).catch(err=>bot.error(500)); + return resolve(200); + + }); + }); } }, ],