Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda