Discord dashboard

https://sourceb.in/D3ZeMpa8n6 https://sourceb.in/lwjX82jY39 Anyone know how to fix this? make it to where my bot will update its counts when it joines servers Just having trouble with this
SourceBin
home.ejs
Instantly share your code with the world.
SourceBin
home.js
Instantly share your code with the world.
4 Replies
114 | Matthew | BCSO
@Helpers
WhacK
WhacK11mo ago
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 */)
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
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Sapphire Framework
Getting started with Sapphire | Sapphire
To install Sapphire, you need to install both discord.js and
Sapphire Framework
Using and extending container | Sapphire
The container is a way in which Sapphire achieves Dependency Injection. This is a very useful feature, since it
Sapphire Framework
Module: @sapphire/plugin-api | Sapphire
Namespaces
114 | Matthew | BCSO
const { GatewayIntentBits, Partials } = require("discord.js")
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()
const { GatewayIntentBits, Partials } = require("discord.js")
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
WhacK
WhacK11mo ago
Then that’s the client you have to pass to use client.guilds.cache.size. Change your line to const { client } = require(‘./pathToThisFile’)
Want results from more Discord servers?
Add your server