Finishing that up
This commit is contained in:
parent
21e96e8d52
commit
4743a46e54
10
index.js
10
index.js
|
@ -623,7 +623,7 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Retruns raw text, paginate it into multiple embeds if needed
|
// Retruns raw text, paginate it into multiple embeds if needed
|
||||||
res.text().then((text) => {
|
res.text().then(async (text) => {
|
||||||
const pages = text.match(/[\s\S]{1,2000}(?=\n|$)/g);
|
const pages = text.match(/[\s\S]{1,2000}(?=\n|$)/g);
|
||||||
// const embeds = pages.map((page, ind) => ({
|
// const embeds = pages.map((page, ind) => ({
|
||||||
// title: `Product Text for ${product_id} Pg ${ind + 1}/${pages.length}`,
|
// title: `Product Text for ${product_id} Pg ${ind + 1}/${pages.length}`,
|
||||||
|
@ -631,12 +631,10 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
// color: 0x00ff00
|
// color: 0x00ff00
|
||||||
// }));
|
// }));
|
||||||
const messages = pages.map((page, ind) => {
|
const messages = pages.map((page, ind) => {
|
||||||
return {
|
return `\`\`\`${page}\`\`\``
|
||||||
content: `\`\`\`${page}\`\`\``,
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
messages.forEach((message) => {
|
messages.forEach(async (message) => {
|
||||||
interaction.followUp({content: message, ephemeral: true});
|
interaction.followUp({ content: message, ephemeral: true });
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
|
Loading…
Reference in a new issue