Yeah ill just leave this to the client
This commit is contained in:
parent
92100ba7f7
commit
012bf8d207
14
index.js
14
index.js
|
@ -62,12 +62,6 @@ client.on("ready", async () => {
|
||||||
|
|
||||||
// Log startup time in seconds
|
// Log startup time in seconds
|
||||||
console.log(`${colors.cyan("[INFO]")} Startup took ${colors.green((Date.now() - initTime) / 1000)} seconds.`)
|
console.log(`${colors.cyan("[INFO]")} Startup took ${colors.green((Date.now() - initTime) / 1000)} seconds.`)
|
||||||
|
|
||||||
// Start fetching user profiles
|
|
||||||
let memStart = Date.now();
|
|
||||||
await client.guilds.cache.get(config.discord.guildID).members.fetch().then(async members => {
|
|
||||||
console.log(`${colors.cyan("[INFO]")} Fetched ${colors.green(members.size)} members. Took ${colors.green((Date.now() - memStart) / 1000)} seconds.`)
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -282,14 +276,6 @@ app.get("/api/levels", async (req, res) => {
|
||||||
if (!rows) return res.sendStatus(204) // No content
|
if (!rows) return res.sendStatus(204) // No content
|
||||||
if (rows) {
|
if (rows) {
|
||||||
let output = rows;
|
let output = rows;
|
||||||
output.forEach((row, i) => {
|
|
||||||
// Get user info {avatar, tag, etc}
|
|
||||||
let user = client.guilds.cache.get(config.discord.guildID).members.cache.get(output[i].id).user;
|
|
||||||
if (!user) return res.json(output)
|
|
||||||
output[i].tag = user.tag;
|
|
||||||
output[i].avatar = user.displayAvatarURL({extension: "png", size: 1024});
|
|
||||||
output[i].banner = user.bannerURL({extension: "png"});
|
|
||||||
});
|
|
||||||
return res.json(output);
|
return res.json(output);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue