Я хочу выводить по 5 ролей в магазине и при нажатии чтобы он выводит дальше роли с массива
//shop.js
const Guild = require('../../guild.js');
const User = require('../../user.js');
const Shop = require('../../shop.js');
const {stripIndents} = require("common-tags")
const { Client, CommandInteraction,MessageActionRow, MessageButton,Interaction,MessageEmbed } = require("discord.js");
module.exports = {
name: "shop",
description: "магазин",
type: 'CHAT_INPUT',
run: async (client, interaction) => {
await interaction.deferReply({ephemeral:true}).catch(() => {});
let guild = await Guild.findOne({id:interaction.guild.id}) || new Guild({id:interaction.guild.id});
let shop = await Shop.findOne({id:interaction.guild.id}) || new Shop({id:interaction.guild.id});
let p = 1;
let txt = " ";
let page = 1
if (!shop.roles.length) txt = "На данный момент предметов в магазине нет :Loading:";
for(var i = 0; i < shop.roles.length; i++) {
txt += `[#${p++}] <@&${shop.roles[i]}> - \`${shop.roles_pr[i]}\` ${guild.val}\n Владелец:<@${shop.user[i]}>\n`
}
if (txt == " ") txt = "На данный момент предметов в магазине нет :Loading:";
let emb = new MessageEmbed()
.setAuthor({name: "Магазин"})
.setTitle(`**Роли**`)
.setColor("GREEN")
.setThumbnail(interaction.guild.iconURL({dynamic:true}))
.setDescription( stripIndents `**${txt}**`)
await interaction.followUp({embeds:[emb], components: [{
type: "ACTION_ROW",
components: [
{
type: "BUTTON",
customId: "buy1",
label: "<-",
style: "SECONDARY",
disabled: shop.page === 1
},
{
type: "BUTTON",
customId: "buy2",
label: "->",
style: "SECONDARY",
disabled: shop.roles.length <= 5
},
{
type: "BUTTON",
label: "Активировать предмет",
customId: "buy3",
style: "SECONDARY",
},
],
}]});
},
};