-
-
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); | |
}); |
Good job you updated it
edit this smh. It's outdated
Updated
You don't use backticks where you define the URL. This causes it to just say ${botID} instead of the actual bot ID.
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.
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.
edit this smh. It's outdated