How to make a new embed when the first embed reaches counter

const { PermissionFlagsBits, SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { getTrackingsOfUser } = require('../../helper/index.js');



// Creates an Object in JSON with the data required by Discord's API to create a SlashCommand
const create = () => {
const command = new SlashCommandBuilder()
.setName('labelof')
.setDescription('Retrive all active labels of user.')
.addUserOption(option =>
option
.setName('user')
.setDescription('The user for retrive labels.')
.setRequired(true)
)
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
return command.toJSON();
};

// Called by the interactionCreate event listener when the corresponding command is invoked
const invoke = async (interaction) => {
const user = interaction.options.getUser('user');
const userId = user.id;


const data = await getTrackingsOfUser(userId, interaction)



if (data.length <= 0){
return await interaction.reply({
content: `${userId} dont have any label active!`,
ephemeral: false
});
} else {
let str = '';
for (let ship of data) {

if (ship.courier === 'ups'){
str += '[`' + ship.trackingNumber + '`]' + `(https://www.ups.com/track?tracknum=${ship.trackingNumber}&loc=en_IT&requester=ST/trackdetails)` + ' • `' + ship.courier.toUpperCase() + '` • [**Download**](' + ship.labelUrl + ')\n'
} else if (ship.courier === 'posteitaliane'){
str += '[`' + ship.trackingNumber + '`]' + `(https://www.poste.it/cerca/index.html#/risultati-spedizioni/${ship.trackingNumber})` + ' • `' + 'POSTE IT' + '` • [**Download**](' + ship.labelUrl + ')\n'
};

};



const embed = new EmbedBuilder()
.setColor(0x2e2e2e)
.setTitle(`List of your labels!`)
.setDescription(str)
.setImage('https://media.discordapp.net/attachments/1167456792087904299/1177712501807390800/scbannerfinal_1.gif')
.setTimestamp()
.setFooter({ text: 'Powered by Shipping Club | discord.gg/shippingclub', iconURL: 'https://cdn.discordapp.com/attachments/1167456792087904299/1181018973261799555/logoanimsc2_1.gif?ex=657f88a1&is=656d13a1&hm=a953a90c81898bd237a0bb4620d01e6a4932fadd264436f7ce82c0e8a68881a2&' });

await interaction.reply({
embeds: [embed],
ephemeral: false
});
}

};


module.exports = {
create,
invoke
};
const { PermissionFlagsBits, SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const { getTrackingsOfUser } = require('../../helper/index.js');



// Creates an Object in JSON with the data required by Discord's API to create a SlashCommand
const create = () => {
const command = new SlashCommandBuilder()
.setName('labelof')
.setDescription('Retrive all active labels of user.')
.addUserOption(option =>
option
.setName('user')
.setDescription('The user for retrive labels.')
.setRequired(true)
)
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
return command.toJSON();
};

// Called by the interactionCreate event listener when the corresponding command is invoked
const invoke = async (interaction) => {
const user = interaction.options.getUser('user');
const userId = user.id;


const data = await getTrackingsOfUser(userId, interaction)



if (data.length <= 0){
return await interaction.reply({
content: `${userId} dont have any label active!`,
ephemeral: false
});
} else {
let str = '';
for (let ship of data) {

if (ship.courier === 'ups'){
str += '[`' + ship.trackingNumber + '`]' + `(https://www.ups.com/track?tracknum=${ship.trackingNumber}&loc=en_IT&requester=ST/trackdetails)` + ' • `' + ship.courier.toUpperCase() + '` • [**Download**](' + ship.labelUrl + ')\n'
} else if (ship.courier === 'posteitaliane'){
str += '[`' + ship.trackingNumber + '`]' + `(https://www.poste.it/cerca/index.html#/risultati-spedizioni/${ship.trackingNumber})` + ' • `' + 'POSTE IT' + '` • [**Download**](' + ship.labelUrl + ')\n'
};

};



const embed = new EmbedBuilder()
.setColor(0x2e2e2e)
.setTitle(`List of your labels!`)
.setDescription(str)
.setImage('https://media.discordapp.net/attachments/1167456792087904299/1177712501807390800/scbannerfinal_1.gif')
.setTimestamp()
.setFooter({ text: 'Powered by Shipping Club | discord.gg/shippingclub', iconURL: 'https://cdn.discordapp.com/attachments/1167456792087904299/1181018973261799555/logoanimsc2_1.gif?ex=657f88a1&is=656d13a1&hm=a953a90c81898bd237a0bb4620d01e6a4932fadd264436f7ce82c0e8a68881a2&' });

await interaction.reply({
embeds: [embed],
ephemeral: false
});
}

};


module.exports = {
create,
invoke
};
hi guys, I'm getting an error because the length of my description is too long compared to 4096, now I'm confused, how can I modify my code, I want to create a new embed every 10 'ship'
1 Reply
d.js toolkit
d.js toolkit6mo 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!