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

202
Views
¿Cómo defino discordia? "error discordia no está definido"
const { Client, Intents, DiscordAPIError } = require('discord.js'); const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); const ytdl = require("ytdl-core") const fs = require('fs'); client.commands = new Discord.Collection(); //error here 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); } const PREFIX = '$'; var version = '1.0.1' var servers = {}; client.once('ready', () => { console.log ('Smegma Music is online!'); }); 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'){ message.channel.send('Shutup Bitch!');{ } function play(connection, message){ var server = servers [message.guild.id]; server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: "audioonly"})); server.queue.shift(); server.dispatcher.on("end", function(){ if(server.queue[0]){ play(connection, message); }else { connection.disconnect(); } }); client.login('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); //at end } }});

La línea 9 es donde está el problema. "cliente.comandos = nuevo Discord.Collection();" Recibo un error cuando intento ejecutar 'node'. dicho

ReferenceError: Discord no está definido en Object. (C:\MusicBot\main.js:9:23)

Estaba funcionando ayer, sin embargo, esto fue con un enfoque diferente a los comandos. Estoy tratando de crear un controlador de comando básico aquí.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Por encima de tratar de hacer una nueva colección, puedes definir discord así:

 const Discord = require("discord.js")
about 4 years ago · Juan Pablo Isaza 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!