nebula
DIAdiscord.js - Imagine an app
•Created by nebula on 4/10/2024 in #djs-questions
TOKEN_INVALID
8 replies
DIAdiscord.js - Imagine an app
•Created by nebula on 4/10/2024 in #djs-questions
TOKEN_INVALID
code in index.js
8 replies
DIAdiscord.js - Imagine an app
•Created by nebula on 4/10/2024 in #djs-questions
TOKEN_INVALID
const express =require("express");
const app = express()
const Discord = require("discord.js")
const client = new Discord.Client ( {intents: [ "GUILDS", "GUILD_MESSAGES", "GUILD_PRESENCES"]
});
const fs = require("fs");
const prefix = 'pls'
client.commands = new Discord.Collection();
const commands = fs.readdirSync("./Commands").filter(file => file.endsWith(".js"));
for (file of commands) {
const commandName = file.split(".")[0]
const command = require(
./Commands/${commandName})
client.commands.set(command.name,
command)
}
client.on("ready", () => {
console.log("online.")
let servers = client.guilds.cache.size
let servercount = client.guilds.cache.reduce((a,b) => a+b.memberCount, 0)
client.user.setActivity(
${client.guilds.cache.size} Servers and ${client.guilds.cache.reduce((a,b) => a+b.memberCount, 0)} Members, { type: "WATCHING" })
});
client.on("messageCreate", message => {
if(message.content.startsWith(prefix)) {
const args = message.content.slice(prefix.length).trim().split(/ +/g)
const commandName = args.shift().toLowerCase()
const command = client.commands.get(commandName)
if(!command) return
command.run(client, message, args)
}
})
client.login(process.env.token);
8 replies
DIAdiscord.js - Imagine an app
•Created by nebula on 4/10/2024 in #djs-questions
TOKEN_INVALID
Djs is 13.11.0 and node vers is 16.7.0
8 replies