Make it so owner-only commands are filtered from cmdlb

This commit is contained in:
Dragon Fire
2020-06-19 15:07:56 -04:00
parent bb2e455acf
commit 953a8234b9
2 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -23,7 +23,7 @@ module.exports = class CommandLeaderboardCommand extends Command {
}
run(msg, { page }) {
const commands = this.filterCommands(this.client.registry.commands);
const commands = this.filterCommands(this.client.registry.commands, this.client.isOwner(msg.author));
const totalPages = Math.ceil(commands.size / 10);
if (page > totalPages) return msg.say(`Page ${page} does not exist (yet).`);
return msg.say(stripIndents`
@@ -51,7 +51,12 @@ module.exports = class CommandLeaderboardCommand extends Command {
.slice((page - 1) * 10, page * 10);
}
filterCommands(commands) {
return commands.filter(command => command.uses !== undefined && !command.unknown && !command.hidden);
filterCommands(commands, owner) {
return commands.filter(command => {
if (command.uses === undefined) return false;
if (command.unknown || command.hidden) return false;
if (!owner && command.ownerOnly) return false;
return true;
});
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "116.34.0",
"version": "116.34.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {