-
Notifications
You must be signed in to change notification settings - Fork 0
/
discord4bots.js
34 lines (32 loc) · 1020 Bytes
/
discord4bots.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
const fetch = require("node-fetch");
module.exports = class VOID {
constructor(token, client) {
this['token'] = token;
this['client'] = client;
return this;
}
serverCount(message) {
fetch(`https://discord4bots.ddns.net/api/bots/stats`, {
method: 'POST',
headers: {
'serverCount': this.client.guilds.cache.size,
'avatarURL':this.client.user.avatarURL(),
'Content-Type': 'application/json',
'Authorization': this.token
},
})
.then(console.log(message || "Server count posted."));
}
async search(id) {
return await fetch(`https://discord4bots.ddns.net/api/bots/${id}`, {
method: 'GET'
})
.then(res => res.json()).then(json => json);
}
async hasVoted(id) {
return await fetch(`https://discord4bots.ddns.net/api/bots/check/${id}`, {method: 'GET',headers: {
'Content-Type': 'application/json', 'Authorization': this.token
}
}).then(res => res.json()).then(async json => json.voted);
}
}