UNPKG

familybotlistapi

Version:
36 lines (33 loc) 1.14 kB
const fetch = require("node-fetch"); module.exports = class VOID { constructor(token, client, domain) { this['token'] = token; this['client'] = client; this['domain'] = domain; return this; } serverCount(message) { fetch(`${this.domain}/api/bots/`, { // method: 'POST', headers: { 'serverCount': this.client.guilds.cache.size, 'Content-Type': 'application/json', 'Authorization': this.token }, }) .then(console.log(message || "Server count posted.")); } async search(id) { return await fetch(`${this.domain}/api/bots/${id}`, { method: 'GET' }) .then(res => res.json()).then(json => json); } async hasVoted(id) { return await fetch(`${this.domain}/api/bots/check/${id}`, { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': this.token } }).then(res => res.json()).then(async json => json.voted); } }