-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (26 loc) · 686 Bytes
/
index.js
File metadata and controls
31 lines (26 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Generated by CoffeeScript 2.3.1
(function() {
var Robot, axios;
axios = require('axios');
module.exports = Robot = class Robot {
constructor(key, api = 'http://www.tuling123.com/openapi/api', answer1) {
this.key = key;
this.api = api;
this.answer = answer1;
}
async ask(info, options = {}, answer = this.answer) {
var ret;
ret = answer ? (await answer(info, options)) : void 0;
if (ret) {
return ret;
}
options.key = this.key;
options.info = info;
return axios.get(this.api, {
params: options
}).then(function(res) {
return res.data;
});
}
};
}).call(this);