Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

436
Vistas
client.channels.cache.get('id') returns empty Map

I want to get a channel with only an ID given. So the way the docs describe is like this: client.channels.cache.get('channel id'), and that's also how I am doing it. But by printing out the cache I see that the cache Map is empty (length = 0). The thing is, placing the console.log(client.channels.cache) in my client "ready" event listener, it gets printed out.

I read that this error could appear if the client is not logged in properly, but this can not be the case since I call the function with a command and the console log in the "ready" event listener is called instantly after the program is started and works better.

So there must be something else I am missing.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you know the channel ID, you could simply fetch the channel by this ID. If it's cached, it returns the cached channel:

const channel = await client.channels.fetch(CHANNEL_ID)

console.log(channel)

fetch() returns a Promise, so you'll need to use await in an async function, or then methods.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda