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

433
Views
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 answers
Answer question

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 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!