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

149
Vistas
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 Respuestas
Responde la pregunta

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