Listing of notes doesnt work

Hi, i explain (sry im french)
6 Replies
d.js toolkit
d.js toolkit•16mo 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!
Snokxx
SnokxxOP•16mo ago
await notes.sort((a, b) => parseInt(b.date) - parseInt(a.date))
for (let i = 0; i < 8 ; i++) {


Embed.addFields([{ name: `📄 - Note du : <t:${Math.floor(parseInt(notes[i].date) / 1000)}:F>`, value: `> **Modérateur/Helper** : ${(await bot.users.fetch(notes[i].moderateurID))}\n > **Membre :** ${(await bot.users.fetch(notes[i].membreID))}\n> **Raison** : \`${notes[i].raison}\`` }])

}
await notes.sort((a, b) => parseInt(b.date) - parseInt(a.date))
for (let i = 0; i < 8 ; i++) {


Embed.addFields([{ name: `📄 - Note du : <t:${Math.floor(parseInt(notes[i].date) / 1000)}:F>`, value: `> **Modérateur/Helper** : ${(await bot.users.fetch(notes[i].moderateurID))}\n > **Membre :** ${(await bot.users.fetch(notes[i].membreID))}\n> **Raison** : \`${notes[i].raison}\`` }])

}
If the men have 8 notes we can see the notes.. If he have less 8 notes we cant, another idea ? I suppose "<=" but doesnt work I try this :
for (let i = 0; i <= 8 ; i++)
for (let i = 0; i <= 8 ; i++)
but doesnt work
urretf
urretf•16mo ago
so you want to display up to 8 notes?
Snokxx
SnokxxOP•16mo ago
Yes !
urretf
urretf•16mo ago
try Math.min(notes.length, 8) it'll take either the length of notes or 8, whichever is smaller
Snokxx
SnokxxOP•16mo ago
Thank u sooo mutch !!!!
Want results from more Discord servers?
Add your server