This repository has been archived by the owner on Aug 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd_captcha.js
57 lines (54 loc) · 1.75 KB
/
cmd_captcha.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
var request = require('request')
module.exports = function(msg, clientArg, args) {
if (args) {
if (msg.mentions[0]) {
var u = msg.mentions[0]
request('https://nekobot.xyz/api/imagegen?type=captcha&username='+u.username+'&url='+u.avatarURL, function(error, response, body) {
let json = JSON.parse(body);
var u = msg.mentions[0]
msg.channel.createMessage({ "embed": {
"color": 11317149,
"footer": {
"text": "~captcha"
},
"image": {
"url": json.message
}
}});
});
} else {
try {
var u = msg.channel.guild.members.find(xd => xd.username.toLowerCase() == args.toLowerCase())
request('https://nekobot.xyz/api/imagegen?type=captcha&username='+u.username+'&url='+u.avatarURL, function(error, response, body) {
let json = JSON.parse(body);
var u = msg.channel.guild.members.find(xd => xd.username.toLowerCase() == args.toLowerCase())
msg.channel.createMessage({ "embed": {
"color": 11317149,
"footer": {
"text": "~captcha"
},
"image": {
"url": json.message
}
}});
});
} catch (err) {
msg.channel.createMessage("Couldnt find the user!")
}
}
} else {
var u = msg.author;
request('https://nekobot.xyz/api/imagegen?type=captcha&username='+u.username+'&url='+u.avatarURL, function(error, response, body) {
let json = JSON.parse(body);
msg.channel.createMessage({ "embed": {
"color": 11317149,
"footer": {
"text": "~captcha"
},
"image": {
"url": json.message
}
}});
});
}
};