Fixed Discord API errors with purge and pagination
This commit is contained in:
parent
77ca68f39b
commit
8d03ddadb3
2 changed files with 2 additions and 5 deletions
|
@ -6,10 +6,7 @@ exports.run = async (message, args) => {
|
||||||
if (args.length === 0 || !args[0].match(/^\d+$/)) return `${message.author.mention}, you need to provide the number of messages to purge!`;
|
if (args.length === 0 || !args[0].match(/^\d+$/)) return `${message.author.mention}, you need to provide the number of messages to purge!`;
|
||||||
const numberOfMessages = parseInt(args[0]) + 1;
|
const numberOfMessages = parseInt(args[0]) + 1;
|
||||||
await message.channel.purge(numberOfMessages);
|
await message.channel.purge(numberOfMessages);
|
||||||
const purgeMessage = await message.channel.createMessage(`Successfully purged ${args[0]} messages.`);
|
return `Successfully purged ${args[0]} messages.`;
|
||||||
await require("util").promisify(setTimeout)(5000);
|
|
||||||
await purgeMessage.delete();
|
|
||||||
return;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.aliases = ["prune"];
|
exports.aliases = ["prune"];
|
||||||
|
|
|
@ -56,7 +56,7 @@ const paginationEmbed = async (message, pages, timeout = 120000) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
reactionCollector.once("end", () => {
|
reactionCollector.once("end", () => {
|
||||||
if (!deleted) currentPage.removeReactions();
|
if (!deleted && manageMessages) currentPage.removeReactions();
|
||||||
});
|
});
|
||||||
return currentPage;
|
return currentPage;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue