diff --git a/README.md b/README.md index 7578b05..ef121f8 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,27 @@ # discordjs-button-pagination A simple package to paginate discord embeds via discord buttons introduced in [discord.js v13](https://github.com/discordjs/discord.js/tree/master). +# Versions + +## `discordjs-button-pagination@interaction` [Default] +for slash command interaction. + +## `discordjs-button-pagination@msg` +for message command. # Installation -* `npm install discordjs-button-pagination` +For `message` event +* `npm install discordjs-button-pagination@msg` + +For `interaction` event +* `npm install discordjs-button-pagination@interaction` + +## Default command: `npm install discordjs-button-pagination` will install the **`interaction`** version # Requirements -Node.js 14.0.0 or newer is required along with Discord.js 13.0.0 +Node.js 16.6.1 or newer is required along with Discord.js 13.0.0 or newer. -# Usage +# Usage for Message Command __Basic Bot Example__ ```js // Import the discordjs-button-pagination package diff --git a/index.js b/index.js index c04146e..585a1ad 100644 --- a/index.js +++ b/index.js @@ -27,7 +27,7 @@ const paginationEmbed = async (msg, pages, buttonList, timeout = 120000) => { const row = new MessageActionRow().addComponents(buttonList); const curPage = await msg.channel.send({ - embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)], + embeds: [pages[page].setFooter({text: `Page ${page + 1} / ${pages.length}`})], components: [row], }); @@ -53,20 +53,20 @@ const paginationEmbed = async (msg, pages, buttonList, timeout = 120000) => { } await i.deferUpdate(); await i.editReply({ - embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)], + embeds: [pages[page].setFooter({text: `Page ${page + 1} / ${pages.length}`})], components: [row], }); collector.resetTimer(); }); collector.on("end", () => { - if (!curPage.deleted) { + if (curPage.editable) { const disabledRow = new MessageActionRow().addComponents( buttonList[0].setDisabled(true), buttonList[1].setDisabled(true) ); curPage.edit({ - embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)], + embeds: [pages[page].setFooter({text: `Page ${page + 1} / ${pages.length}`})], components: [disabledRow], }); }