From 01277e63cd7bfb719b2249f924dc47b313ece27f Mon Sep 17 00:00:00 2001 From: Menci Date: Wed, 29 Mar 2017 15:19:04 +0800 Subject: [PATCH] Fix hitokoto server busy caused empty panel --- utility.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utility.js b/utility.js index bf7464a..377def6 100644 --- a/utility.js +++ b/utility.js @@ -250,7 +250,7 @@ module.exports = { async hitokoto() { try { let request = require('request-promise'); - return await request({ + let res = await request({ uri: 'http://api.hitokoto.us/rand', timeout: 1500, qs: { @@ -259,6 +259,8 @@ module.exports = { }, json: true }); + if (!res.hitokoto) return null; + else return res; } catch (e) { return null; }