I want to be able to make a command that when called, returns the user’s rank on the leaderboard. The Finals leaderboard API is https://storage.googleapis.com/embark-discovery-leaderboard/leaderboard-crossplay-discovery-live.json . I gave nightbot this type of code to test querying the api but it returns “fetch is not defined” `main();
const FINALS_NAME = “rhexos#6890”;
async function main() {
const entries = await fetchLeaderboardEntries();
const entry = entries.find((e) => e.name == FINALS_NAME);
console.log({
name: entry.name,
rank: entry.r,
oneDayChange: entry.or - entry.r,
cashouts: entry.c,
fame: entry.f,
});
}
async function fetchLeaderboardEntries() {
return fetch(
“https://storage.googleapis.com/embark-discovery-leaderboard/leaderboard-crossplay-discovery-live.json”,
{
method: “GET”,
headers: {
“User-Agent”: “Nightbot”,
},
}
).then((res) => res.json());
}`