SquogAdmin/index.js

33 lines
749 B
JavaScript

// Base requires
const { Client, GatewayIntentBits } = require("discord.js")
const fs = require("fs")
// TOKEN is stored in the .env file (node --env-file=.env index.js)
const token = process.env.TOKEN
// Creating a client
const client = new Client({
intents: [
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages]
}
)
module.exports = client
// Requiring all the event files.
fs.readdir(`${__dirname}/events/`, (err, files) => {
files.forEach(file => {
if (!file.endsWith(".js")) {
return
}
require(`${__dirname}/events/${file}`)
})
})
// Time to login
client.login(token)