Port pagination fix from class-commands, replaced a playing message

This commit is contained in:
TheEssem 2021-03-30 17:00:07 -05:00
parent 162bc7c093
commit 4fb379474b
2 changed files with 4 additions and 3 deletions

View file

@ -32,7 +32,7 @@
"Twitter",
"Reddit",
"Super Smash Bros. Ultimate",
"Yuzu",
"Ryujinx",
"Battletoads for Wii",
"MS Paint",
"Roblox",

View file

@ -21,12 +21,13 @@ module.exports = async (message, pages, timeout = 120000) => {
break;
case "🔢":
message.channel.createMessage(`${message.author.mention}, what page do you want to jump to?`).then(askMessage => {
const messageCollector = new MessageCollector(askMessage.channel, (response) => response.author.id === message.author.id && !isNaN(response.content) && Number(response.content) <= pages.length, {
const messageCollector = new MessageCollector(askMessage.channel, (response) => response.author.id === message.author.id && !isNaN(response.content) && Number(response.content) <= pages.length && Number(response.content) > 0, {
time: timeout,
maxMatches: 1
});
return messageCollector.on("message", async response => {
return messageCollector.on("message", async (response) => {
if (askMessage.channel.messages.get(askMessage.id)) askMessage.delete();
if (manageMessages) await response.delete();
page = Number(response.content) - 1;
currentPage = await currentPage.edit(pages[page]);
if (manageMessages) msg.removeReaction("🔢", member.id);