Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda