Skip to content

Instantly share code, notes, and snippets.

@dellybot
Last active May 29, 2021 13:52
Show Gist options
  • 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);
});
@TheMoksej
Copy link

edit this smh. It's outdated

@TheMoksej
Copy link

Good job you updated it

@carolinaisslaying
Copy link

edit this smh. It's outdated

Updated

@Vetlix
Copy link

Vetlix commented Sep 27, 2020

You don't use backticks where you define the URL. This causes it to just say ${botID} instead of the actual bot ID.

@carolinaisslaying
Copy link

You don't use backticks where you define the URL. This causes it to just say ${botID} instead of the actual bot ID.

Thank you for noticing, you're absolutely right, let me fix.

Copy link

ghost commented Apr 13, 2021

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