Listing of notes doesnt work

Hi, i explain (sry im french)
6 Replies
d.js toolkit
d.js toolkit2y 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
SnokxxOP2y 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
urretf2y ago
so you want to display up to 8 notes?
Snokxx
SnokxxOP2y ago
Yes !
urretf
urretf2y ago
try Math.min(notes.length, 8) it'll take either the length of notes or 8, whichever is smaller
Snokxx
SnokxxOP2y ago
Thank u sooo mutch !!!!
Want results from more Discord servers?
Add your server