Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
How can i make my Bot show only some directories from my Commands

Hello everyone i've been trying to do a help command which lists all directories and their files. The problem is that i want to keep some of those directories/commands secretly. How to implement this Code into Embeds i do already know so i just wanna know how to make only some directories available to see. This is what i made so far: `

let categories = [];

        fs.readdirSync("./commands/").forEach((dir) => {
            const commands = fs.readdirSync(`./commands/${dir}/`).filter((file) =>
              file.endsWith(".js")
            );
    
            const cmds = commands.map((command) => {
              let file = require(`../../commands/${dir}/${command}`);
    
              if (!file.name) return //"No command name.";
    
              let name = file.name.replace(".js", "");
    
              return `\`${name}\``;
            });
    
            let FileData = new Object();
    
            FileData = {
              name: dir.toUpperCase(),
              value: cmds.length === 0 ? "In progress." : cmds.join(" "),
            };

            const InvalidDirs = [
                'blaxyy-server',
                'minecraft-server',
                'owner-only'
            ]

            categories.push(FileData)
        });`

The commands and directory names should be then on the Embed but i want to keep the directories which are listed in InvalidDirs private so not everyone sees them.

Anybody knows how i could do it?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In each file that you want to keep secret, add a property like this

name: 'command name',
description: 'Command Description.',
secret: true,

Then check for it here

fs.readdirSync("./commands/").forEach((dir) => {
    const commands = fs.readdirSync(`./commands/${dir}/`).filter((file) =>
        file.endsWith(".js")
    );

    const cmds = commands.map((command) => {
        let file = require(`../../commands/${dir}/${command}`);

        if (file.secret) return; // this is the line that will check for the secret property

        if (!file.name) return //"No command name.";

        let name = file.name.replace(".js", "");

        return `\`${name}\``;
    });

    let FileData = new Object();

    FileData = {
        name: dir.toUpperCase(),
        value: cmds.length === 0 ? "In progress." : cmds.join(" "),
    };

    categories.push(FileData)
});
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda