Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

48
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)
7 months ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.