UNPKG

dumb-botlistjs

Version:

A liblary for Dumb Bot API actions

43 lines (39 loc) 976 B
const fetch = require("node-fetch"); module.exports = class UDL { constructor(token, client) { this["token"] = token; this["client"] = client; return this; } serverCount(message) { fetch(`https://dumbbotlist.tk/api/bots/stats`, { method: "POST", headers: { serverCount: this.client.guilds.cache.size, "Content-Type": "application/json", Authorization: this.token, }, }).then(console.log(message || "Server count posted.")); } async hasVoted(id) { return await fetch(`https://dumbbotlist.tk/api/bots/check/${id}`, { method: "GET", headers: { "Content-Type": "application/json", Authorization: this.token, }, }) .then((res) => res.json()) .then(async (json) => json.voted); } async profile(id) { return await fetch(`https://dumbbotlist.tk/api/bots/${id}`, { method: "GET", headers: { "Content-Type": "application/json" }, }) .then((res) => res.json()) .then(async (json) => json); } };