From 233c1804d97b0b65586346ce1ec0e43e01891c9c Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Wed, 8 May 2024 14:35:26 -0600 Subject: [PATCH] Refactor pagination logic in index.js and update interaction reply to followUp --- index.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 91fb056..cae0520 100644 --- a/index.js +++ b/index.js @@ -624,12 +624,19 @@ discord.on("interactionCreate", async (interaction) => { // Retruns raw text, paginate it into multiple embeds if needed res.text().then((text) => { const pages = text.match(/[\s\S]{1,2000}(?=\n|$)/g); - const embeds = pages.map((page, ind) => ({ - title: `Product Text for ${product_id} Pg ${ind + 1}/${pages.length}`, - description: `\`\`\`${page}\`\`\``, - color: 0x00ff00 - })); - interaction.reply({ embeds, ephemeral: true }); + // const embeds = pages.map((page, ind) => ({ + // title: `Product Text for ${product_id} Pg ${ind + 1}/${pages.length}`, + // description: `\`\`\`${page}\`\`\``, + // color: 0x00ff00 + // })); + const messages = pages.map((page, ind) => { + return { + content: `\`\`\`${page}\`\`\``, + } + }) + messages.forEach((message) => { + interaction.followUp({content: message, ephemeral: true}); + }) }); }); }