const dinodb = await DinoBreed.findOne({ Dino: dinoFromDb }).lean().exec();
let historyarray = dinodb.History
historyarray = historyarray.map(element => element + '\n ');
if (historyarray.length == 0) {
const embed = new EmbedBuilder()
.setDescription(`${dinoFromDb} não possue histórico.`)
return interaction.reply({ embeds: [embed] })
}
let historyData = JSON.stringify(historyarray)
historyData = historyData.replace('[', '').replace(/"/g, '').replace(']', '').replace(/,/g, '')
const embed = new EmbedBuilder()
.setTitle(`${dinodb.Dino} History`)
.setDescription(historyData)
interaction.reply({ embeds: [embed] })```
#New line problem
14 messages · Page 1 of 1 (latest)
heres my code
Use "\n" not '\n'
No wait, actually use .join("\n") to make your array into a string, not JSON stringify
bash moment
thank you
btw if u dont mind , what would be the difference between using " in \n and '
you don't need the map either btw
nothing
or the replace
Yeah, got confused for a moment…
those are sideeffects of using encoding rather than stringification
if you just use join you can avoid the map and replace you have
thank you