Hide auto reply commands in help if in bot list server

This commit is contained in:
Dragon Fire
2020-04-11 11:20:25 -04:00
parent 6169f79125
commit dfe8c0a5e0
+9 -1
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const { stripIndents } = require('common-tags');
const AutoReplyCommand = require('../../structures/commands/AutoReply');
module.exports = class HelpCommand extends Command {
constructor(client) {
@@ -30,7 +31,14 @@ module.exports = class HelpCommand extends Command {
let cmdCount = 0;
for (const group of this.client.registry.groups.values()) {
const owner = this.client.isOwner(msg.author);
const commands = group.commands.filter(cmd => (owner ? true : !cmd.ownerOnly) && !cmd.hidden);
const commands = group.commands.filter(cmd => {
if (owner) return true;
if (cmd.ownerOnly || cmd.hidden) return false;
if (this.client.botListGuilds.includes(msg.guild.id) && cmd instanceof AutoReplyCommand) {
return false;
}
return true;
});
if (!commands.size) continue;
cmdCount += commands.size;
embed.addField(