#Discord dashboard

1 messages · Page 1 of 1 (latest)

prime crescent
prime crescent
#

<@&737143830020620288>

dreamy mauve
#

I can't speak to the .ejs code I don't use that much. Your home.js file doesn't implement Client correctly. Somewhere in your code you'll new to create a new client:

const { Client } = require('discord.js';

const client = new Client(/* options here */);

await client.login(/* token */).catch(/* error stuff */)

You can then pass that instantiation of the object to ther files in your project to make the client accessible. i.e client.guilds.cache.size.

The discord.js guide has a really simple walkthrough to get the skeleton setup or you could use something like the sapphire framework which sets up the router (might be a plugin the docs explain tho) and dependency injection for you (container.client).

https://discordjs.guide/creating-your-bot/main-file.html

https://www.sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire

https://www.sapphirejs.dev/docs/Guide/additional-information/using-and-extending-container

https://www.sapphirejs.dev/docs/Documentation/api-plugins/modules/sapphire_plugin_api

prime crescent
# dreamy mauve I can't speak to the `.ejs` code I don't use that much. Your `home.js` file does...
const { CustomClient } = require("./Structures/Classes/CustomClient")
const { loadEvents } = require("./Structures/Functions/EventLoader")

require("dotenv").config()

const client = new CustomClient({
    intents: [
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.Guilds,
        GatewayIntentBits.MessageContent
    ],
    partials: [
        Partials.Channel,
        Partials.Message,
        Partials.Reaction
    ]
})

loadEvents(client)

module.exports = client

client.start()``` ive got my client here
dreamy mauve
#

Then that’s the client you have to pass to use client.guilds.cache.size.