Browse Source

Fix hitokoto server busy caused empty panel

master
Menci 8 years ago
parent
commit
01277e63cd
  1. 4
      utility.js

4
utility.js

@ -250,7 +250,7 @@ module.exports = {
async hitokoto() { async hitokoto() {
try { try {
let request = require('request-promise'); let request = require('request-promise');
return await request({ let res = await request({
uri: 'http://api.hitokoto.us/rand', uri: 'http://api.hitokoto.us/rand',
timeout: 1500, timeout: 1500,
qs: { qs: {
@ -259,6 +259,8 @@ module.exports = {
}, },
json: true json: true
}); });
if (!res.hitokoto) return null;
else return res;
} catch (e) { } catch (e) {
return null; return null;
} }

Loading…
Cancel
Save