Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
TypeError: (valor intermedio) no es una función

así que actualmente estoy creando un bot de Discord usando Discord.JS V13.

Sigo recibiendo este error cuando ejecuto el comando node index.js

 TypeError: (intermediate value) is not a function at module.exports (C:\Users\myUser\OneDrive\Desktop\Green Hosting Discord bot\Handlers\Events.js:10:5)

No sé por qué está haciendo esto. El código es:

 const { Events } = require("../Validation/EventNames"); const { promisify } = require("util"); const { glob } = require("glob"); const PG = promisify(glob); const Ascii = require("ascii-table"); module.exports = async (client) => { const Table = new Ascii("Events Loaded") (await PG(`${process.cwd()}/Events/*/*.js`)).map(async (file)=>{ const event = require(file); if(!Events.includes(event.name) || !event.name) { const L = file.split("/"); await Table.addRow(`${event.name || "MISSING"}`, `⛔ Event name is either invalid or missing: ${L[6] + "/" + L[7]}`) return; }; if(event.once){ client.once(event.name, (...args)=>event.execute(...args, client)); } else { client.on(event.name, (...args)=>event.execute(...args, client)); }; await Table.addRow(event.name, "✔ SUCCESSFUL") }); console.log(Table.toString()); };

Si pudieras ayudarme, sería increíble. Gracias.

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

No hay punto y coma después de const Table = new Ascii("Events Loaded") . La inserción automática de punto y coma solo se aplicará si sin el punto y coma el código no sería válido si se concatena. Sin embargo, aquí el código es válido (pero falla en tiempo de ejecución):

 const Table = new Ascii("Events Loaded") (await PG(`${process.cwd()}/Events/*/*.js`)).map(/*...*/)

⬇

 const Table = new Ascii("Events Loaded")(await PG(`${process.cwd()}/Events/*/*.js`)).map(/*...*/)

Como puede ver, esta sería una llamada de función en el valor de retorno de new Ascii("Events Loaded") . Sin embargo, esa no es una función y no se puede llamar, de ahí el error.

Por lo tanto, la solución es agregar el punto y coma faltante aquí:

 const Table = new Ascii("Events Loaded"); // ^

O bien, si desea escribir código sin punto y coma, debe insertar un punto y coma al comienzo de las líneas si comienzan con ciertos caracteres , incluidos ( , como es el caso aquí:

 ;(await PG(`${process.cwd()}/Events/*/*.js`)).map(/*...*/)
about 4 years ago · Santiago Gelvez Report

0

Probar:

 const promise = await PG(`${process.cwd()}/Events/*/*.js`) promise.map(async (file)=>{ // code... });

O tal vez, es el punto y coma:

 const Table = new Ascii("Events Loaded"); //--------------------------------------^ (await PG(`${process.cwd()}/Events/*/*.js`)).map(async (file)=>{
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!