Skip to content

Instantly share code, notes, and snippets.

@dellybot
Last active May 29, 2021
Embed
What would you like to do?
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

TheMoksej commented Sep 15, 2020

edit this smh. It's outdated

@TheMoksej
Copy link

TheMoksej commented Sep 23, 2020

Good job you updated it

@Cairo2k18
Copy link

Cairo2k18 commented Sep 23, 2020

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.

@Cairo2k18
Copy link

Cairo2k18 commented Sep 28, 2020

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.

@PhantomNimbi
Copy link

PhantomNimbi 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