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

239
Views
Trying to fetch all of the servers that my bot is in
module.exports = {
    name: 'listguilds',
    description: 'lists the bots guilds',
    execute(message, args, client) {
        
        const Guilds = client.guilds.cache.map(guild => guild.id);
    console.log(Guilds);
    }}

Im trying to fetch all the ID's of all of the guilds that my bot is in but i keep getting this error

TypeError: Cannot read property 'guilds' of undefined
    at Object.execute (C:\Users\User\Desktop\botname\commands\listguilds.js:6:31)
    at Client.<anonymous> (C:\Users\User\Desktop\botname\index.js:96:11)
    at Client.emit (node:events:365:28)
    at MessageCreateAction.handle (C:\Users\User\Desktop\botname\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\User\Desktop\botname\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\User\Desktop\botname\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\User\Desktop\botname\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\User\Desktop\botname\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\User\Desktop\botname\node_modules\ws\lib\event-target.js:132:16)
about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!