-
Notifications
You must be signed in to change notification settings - Fork 27
/
compliment.js
67 lines (48 loc) · 1.37 KB
/
compliment.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var request = require("request");
const
_description = "Will give you a random compliment! - by Mason",
_help = {
"/compliment": "Get a compliment! Will give a random compliment. - by Mason"
}
;
var ComplimentPlugin = function (data) {
var that = this;
that.bot = data.bot;
that.help = _help;
function getCompliment(input) {
request.get({
url: "https://compliment-api.herokuapp.com/",
json: true,
headers: {
'User-Agent': 'JQBX.FM Bot'
}
}, function (err, resp) {
if (err) return that.bot.emit("error", err);
var str = "No compliments found.";
if (resp.body) {
str = resp.body;
}
// if (input) {
// str = "Hey " + input + ", "+ str;
// }
that.bot.emit("do:commandResponseExpandable", str);
});
}
that.commands = {
"/compliment": function (input) {
getCompliment(input);
}
};
return that;
};
ComplimentPlugin.help = _help;
ComplimentPlugin.description = _description;
module.exports = ComplimentPlugin;
// This can be tested locally, like so:
// var DJ = new ComplimentPlugin({
// bot:{
// on: console.log,
// emit: console.log
// }
// });
// DJ.commands["/compliment"]("", {});