Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
Patch of the Footer bug that does not recover correctly.
Browse files Browse the repository at this point in the history
Update version
  • Loading branch information
devRael1 committed Dec 25, 2022
1 parent a389322 commit a60741b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devraelfreeze/discordjs-pagination",
"version": "2.6.6",
"version": "2.6.8",
"description": "A pagination module for Discord.js v13 & v14",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
9 changes: 5 additions & 4 deletions src/pagination/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ export const pagination = async (options: PaginationOptions) => {

const changeFooter = () => {
const embed = embeds[currentPage - 1];
const newEmbed = new EmbedBuilder(embed.toJSON());
if (embed?.footer?.text) {
const embedJSON = embed.toJSON();
const newEmbed = new EmbedBuilder(embedJSON);
if (Object.prototype.hasOwnProperty.call(embedJSON, 'footer')) {
return newEmbed.setFooter({
text: `${embed.footer.text} - Page ${currentPage} / ${embeds.length}`,
iconURL: embed.footer.iconURL
text: `Page ${currentPage} / ${embeds.length} - ${embedJSON.footer.text}`,
iconURL: embedJSON.footer.icon_url
});
}
return newEmbed.setFooter({
Expand Down

0 comments on commit a60741b

Please sign in to comment.