mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Filter suggest-command commands
This commit is contained in:
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "116.1.0",
|
||||
"version": "116.1.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user