API help Discord.js 14

I am working on a slash command that takes all players from a link / API with name and ID of a game. These IDs are taken and inserted into another API to get the respective Elo of the player. I display these in several embeds as a ranking list, but unfortunately only a few players (10 out of 50) are displayed for clans with many players (50 players is max). I get an error code for the players that are not displayed. I think the api is overloaded/had too many requests, does anyone know if I can do anything about it in the code or is it really just due to the limited access of the API? Errors: (for each missing player)
Error fetching data for player 9243413: Error: API request failed with status 408
at C:\Users\---myname---\OneDrive\Desktop\discord-bot\commands\utility\servername_rankedlist.js:52:31
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 33)
at async Object.execute (C:\Users\---name---\OneDrive\Desktop\discord-bot\commands\utility\servername_rankedlist.js:48:35)
at async Client.<anonymous> (C:\Users\---myname---\OneDrive\Desktop\discord-bot\index.js:59:3)
Error fetching data for player 9243413: Error: API request failed with status 408
at C:\Users\---myname---\OneDrive\Desktop\discord-bot\commands\utility\servername_rankedlist.js:52:31
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 33)
at async Object.execute (C:\Users\---name---\OneDrive\Desktop\discord-bot\commands\utility\servername_rankedlist.js:48:35)
at async Client.<anonymous> (C:\Users\---myname---\OneDrive\Desktop\discord-bot\index.js:59:3)
Line 48:
const playerRatings = await Promise.all(limitedPlayers.map(async (player) => {
try {
const playerResponse = await fetch(playerUrl(player.brawlhalla_id));
if (!playerResponse.ok) {
throw new Error("API request failed with status ${playerResponse.status}");
}
const playerRatings = await Promise.all(limitedPlayers.map(async (player) => {
try {
const playerResponse = await fetch(playerUrl(player.brawlhalla_id));
if (!playerResponse.ok) {
throw new Error("API request failed with status ${playerResponse.status}");
}
My code: ``````
5 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
Hype
HypeOP4mo ago
my code:




Hype
HypeOP4mo ago
everything up2date
treble/luna
treble/luna4mo ago
doesnt look djs related, #other-js-ts
Hype
HypeOP4mo ago
alr
Want results from more Discord servers?
Add your server