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

139
Views
Cannot read properties of undefined (reading 'guilds') on discord.js v13

I have this problem and I don't know how to solve it, I'm new to this, so if you can help me it would be the best :D

Error:

    let Servers = client.guilds.cache.filter(g => g)
                         ^

TypeError: Cannot read properties of undefined (reading 'guilds')

And this would be the code snippet where the error is found.

async function checkUnbans() {
    let Servers = client.guilds.cache.filter(g => g)
    Servers.map(async g => {
        let SDB = await ServerSettings.findOne({GuildID: g.id})
        if(!SDB) return CreateServer(g.id)
        let Channel = g.channels.cache.get(SDB.GuildConfig[0].ModLogs.Channel)
        if(Channel) {
            let FBanned = await ModLogs.find({GuildID: g.id})
            FBanned.forEach(async (u) => {
                if(u.Type == "TEMPBAN") {
                    let Time = u.Time || 0
                    if(parseInt(u.OcurredDate) + parseInt(Time) < Date.now()) {
                        if(u.Unbanned == false) {
                        
                            let c = g.members.cache.get(u.UserID)
                            if(!c) {
                                let count = await ModLogs.countDocuments({GuildID: g.id})
                                 await UnbanM(g, u, count, Channel)
                            }
                        }
                    }
                }
            })
        }
    })
}

If this is any information, this is how I define some elements.

const ServerSettings = require('../models/ServerConfigModel')
const ModLogs = require('../models/ModLogs')
const { CreateServer } = require('./CreateDB')
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to define the serverL

let server= message.guild.server.cache.find(server=> server.name === 'bot-logs')

I hope this works!

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!