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

191
Views
El script console.log devuelve "¡Canal incorrecto!"

Estoy configurando un bot de Discord y quiero que envíe un mensaje al canal principal de mi servidor cuando escriba node . . Escribí:

 client.on('ready', () => { const Channel = client.channels.cache.get('<My.General.Channel.ID#>'); if (!Channel) return console.log('Wrong channel!'); else Channel.send('I am here'); });

Me sale "¡Canal equivocado!". Debería insertar el número de identificación del canal, ¿verdad? He pegado directamente desde "Copiar ID" de Discord y todavía tengo un problema.

Editar:

Actualicé mis intenciones y mi código. Ahora muestra:

 client.on('ready', message => { client.channels.cache.get('channel-id').send('message.')

Esto resolvió mis problemas.

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

0

si está usando v12, esto debe funcionar para su error.

 client.on("message", function(message) { const Channel = message.channel.id == <My.General.Channel.ID#>; if (!Channel) return console.log('Wrong channel!'); else message.channel.send('I am here'); });
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!