Port pagination fix from class-commands, replaced a playing message
This commit is contained in:
parent
162bc7c093
commit
4fb379474b
2 changed files with 4 additions and 3 deletions
|
@ -32,7 +32,7 @@
|
||||||
"Twitter",
|
"Twitter",
|
||||||
"Reddit",
|
"Reddit",
|
||||||
"Super Smash Bros. Ultimate",
|
"Super Smash Bros. Ultimate",
|
||||||
"Yuzu",
|
"Ryujinx",
|
||||||
"Battletoads for Wii",
|
"Battletoads for Wii",
|
||||||
"MS Paint",
|
"MS Paint",
|
||||||
"Roblox",
|
"Roblox",
|
||||||
|
|
|
@ -21,12 +21,13 @@ module.exports = async (message, pages, timeout = 120000) => {
|
||||||
break;
|
break;
|
||||||
case "🔢":
|
case "🔢":
|
||||||
message.channel.createMessage(`${message.author.mention}, what page do you want to jump to?`).then(askMessage => {
|
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,
|
time: timeout,
|
||||||
maxMatches: 1
|
maxMatches: 1
|
||||||
});
|
});
|
||||||
return messageCollector.on("message", async response => {
|
return messageCollector.on("message", async (response) => {
|
||||||
if (askMessage.channel.messages.get(askMessage.id)) askMessage.delete();
|
if (askMessage.channel.messages.get(askMessage.id)) askMessage.delete();
|
||||||
|
if (manageMessages) await response.delete();
|
||||||
page = Number(response.content) - 1;
|
page = Number(response.content) - 1;
|
||||||
currentPage = await currentPage.edit(pages[page]);
|
currentPage = await currentPage.edit(pages[page]);
|
||||||
if (manageMessages) msg.removeReaction("🔢", member.id);
|
if (manageMessages) msg.removeReaction("🔢", member.id);
|
||||||
|
|
Loading…
Reference in a new issue