mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 08:22:37 +02:00
Filter suggest-command commands
This commit is contained in:
@@ -13,7 +13,15 @@ module.exports = class SuggestCommandCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg) {
|
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`
|
return msg.say(stripIndents`
|
||||||
Have you tried **${command.name}**?
|
Have you tried **${command.name}**?
|
||||||
_${command.description}_
|
_${command.description}_
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "116.1.0",
|
"version": "116.1.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user