Not working.join()



  • I'm just saying I'm new to JS. I'm making a booth for Discord.

    async function exec(client, command) {
        const commandFiles = require('../main')
        console.log(commandFiles.join(", ")) //выводит: commandFiles.join is not a function
    }
    

    It's the code of the function that the team has to put in a chain of command.

    const commandFiles = fs.readdirSync(`./bot-commands/`).filter(file => file.endsWith('.js'));
    

    This is commandFiles.

    If you just pull commandFiles without a method of joining, it turns out https://i.stack.imgur.com/6bLoz.png which are in a separate folder



  • You don't have a bunch of teams on the squeaky list, but the object where this mass lies with the key commandFiles. If you want to get the mass, change it.

    const commandFiles = require('../main')
    

    Here.

    const {commandFiles} = require('../main')
    

    Either that part of it stays as it is, but then you're gonna burn the mass, not the object:

    commandFiles.commandFiles.join(", ")
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2