• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

171
Views
robot discordia | No se puede leer la propiedad 'conjunto' de indefinido

Recibo un error y no sé cómo resolverlo y no sé dónde cometí un error. Estoy usando discord.js v12 Estoy haciendo este bot en el sitio web llamado "Glitch"

No puedo resolverlo por mí mismo después de 2 horas. Miré muchas publicaciones pero ninguna resolvió mi problema.

mi error:

 /app/main.js:25 client.commands.set(command.name, command); ^ TypeError: Cannot read property 'set' of undefined at Object.<anonymous> (/app/main.js:25:21) at Module._compile (internal/modules/cjs/loader.js:759:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Function.Module.runMain (internal/modules/cjs/loader.js:826:10) at internal/main/run_main_module.js:17:11

mi código:

 const discord = require("discord.js"); const client = new discord.Client(); const config = require("./config.json"); const fs = require('fs'); const prefix = client.PREFIX; client.on("warn", info => console.log(info)); client.on("error", console.error) client.on("ready", () => { console.log(`Loggined in as ${client.user.tag}!`) client.user.setActivity(`${client.activity}`, { type: `${client.activityType}`}) }) const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for(const file of commandFiles){ const command = require(`./commands/${file}`); client.commands.set(command.name, command); }; client.on('message', message =>{ if(!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).split(/ +/); const command = args.shift().toLowerCase(); if(command === 'ping'){ client.commands.get('ping').execute(message, args); }; }) client.commands = new discord.Collection() client.PREFIX = config.PREFIX client.activity = config.ACTIVITY client.activityType = config.ACTIVITYTYPE client.login(process.env.TOKEN)
about 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error