Skip to content

Instantly share code, notes, and snippets.

@dellybot
Last active May 29, 2021 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dellybot/a46ba05746c29e9d664a2efc6c2fbb75 to your computer and use it in GitHub Desktop.
Save dellybot/a46ba05746c29e9d664a2efc6c2fbb75 to your computer and use it in GitHub Desktop.
const fetch = require("node-fetch");
const botID = client.user.id; // You will probably need to change this
const URL = `https://api.discordextremelist.xyz/v2/bot/${botID}/stats`;
const reqHeaders = {
"Content-Type": "application/json",
"Authorization": "TOKEN" // Put your DELAPI token here
}
const reqBody = {
"guildCount": client.guilds.cache.size // You will probably need to change this
}
fetch(url, { method: "POST", headers: reqHeaders, body: JSON.stringify(reqBody)})
.then((res) => {
return res.json()
})
.then((json) => {
console.log(json);
});
@PhantomNimbi
Copy link

You specifed the url string wrong in the fetch(url, { method: "POST", headers: reqHeaders, body: JSON.stringify(reqBody)}) .then((res) => { return res.json()}) part.

According to your const URL = `https://api.discordextremelist.xyz/v2/bot/${botID}/stats`; it should be fetch(URL, { method: "POST", headers: reqHeaders, body: JSON.stringify(reqBody)}) .then((res) => { return res.json()})

Basically it's case sensative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment