Make pagination only apply when there's more than a single page

This commit is contained in:
Essem 2021-08-06 12:12:59 -05:00
parent ac1242f74b
commit dea160c73b
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
1 changed files with 65 additions and 63 deletions

View File

@ -16,6 +16,7 @@ module.exports = async (client, message, pages, timeout = 120000) => {
}; };
let page = 0; let page = 0;
let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options)); let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options));
if (pages.length > 1) {
const emojiList = ["◀", "🔢", "▶", "🗑"]; const emojiList = ["◀", "🔢", "▶", "🗑"];
for (const emoji of emojiList) { for (const emoji of emojiList) {
await currentPage.addReaction(emoji); await currentPage.addReaction(emoji);
@ -80,5 +81,6 @@ module.exports = async (client, message, pages, timeout = 120000) => {
return; return;
} }
}); });
}
return currentPage; return currentPage;
}; };