Filter suggest-command commands

This commit is contained in:
Dragon Fire
2020-06-04 12:53:16 -04:00
parent 3fb382612a
commit 4fdfd7b124
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -13,7 +13,15 @@ module.exports = class SuggestCommandCommand extends Command {
}
run(msg) {
const command = this.client.registry.commands.random();
const command = this.client.registry.commands
.filter(cmd => {
if (cmd.hidden || cmd.unknown) return false;
if (!msg.channel.nsfw && cmd.nsfw) return false;
if (!this.client.isOwner(msg.author) && cmd.ownerOnly) return false;
if (!msg.guild && cmd.guildOnly) return false;
return true;
})
.random();
return msg.say(stripIndents`
Have you tried **${command.name}**?
_${command.description}_
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "116.1.0",
"version": "116.1.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {