GatewayIntentBits.Guilds - Cannot read properties of undefined (reading 'Guilds')

here is exactly everything. I'm following the docs so idk what's wrong. Version and full error images attached.

const fs = require('fs');
require("dotenv").config();

const { Client, GatewayIntentBits, Partials, Collection } = require('discord.js');

const Topgg = require("@top-gg/sdk"); //topgg stuff
const express = require("express");
const userVote = require("./User functions/userVote");

const app = express()

const webhook = new Topgg.Webhook("LlamaLoot6543");

app.post("/dblwebhook", webhook.listener(vote => {
    userVote(vote);
}))

console.log("app listening");
app.listen(80);   //topgg stuff

global.client = new Client({      // **** client is here *****
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildMembers
    ], 
    partials: [Partials.Channel]
});


const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

const commands = [];

client.commands = new Collection();

//command register
for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    commands.push(command.data.toJSON());
    client.commands.set(command.data.name, command);
}

//event register
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));

for (const file of eventFiles) {
    const event = require(`./events/${file}`);
    if (event.once) {
        client.once(event.name, (...args) => event.execute(...args, commands));
    } else {
        client.on(event.name, (...args) => event.execute(...args, commands));
    }
}

client.login(token);
unknown.png
unknown.png
Was this page helpful?