|
|
@ -248,15 +248,20 @@ module.exports = { |
|
|
|
return md5.digest('hex'); |
|
|
|
return md5.digest('hex'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
async hitokoto() { |
|
|
|
async hitokoto() { |
|
|
|
let request = require('request-promise'); |
|
|
|
try { |
|
|
|
return await request({ |
|
|
|
let request = require('request-promise'); |
|
|
|
uri: 'http://api.hitokoto.us/rand', |
|
|
|
return await request({ |
|
|
|
qs: { |
|
|
|
uri: 'http://api.hitokoto.us/rand', |
|
|
|
encode: 'json', |
|
|
|
timeout: 1500, |
|
|
|
cat: 'a' |
|
|
|
qs: { |
|
|
|
}, |
|
|
|
encode: 'json', |
|
|
|
json: true |
|
|
|
cat: 'a' |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
json: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
isValidUsername(s) { |
|
|
|
isValidUsername(s) { |
|
|
|
return /^[a-zA-Z0-9\-\_]+$/.test(s); |
|
|
|
return /^[a-zA-Z0-9\-\_]+$/.test(s); |
|
|
|