Added .env and added it to .gitignore, fixed some README.md and made index.js a module in package.json

This commit is contained in:
entar 2025-05-18 10:21:29 +07:00
parent 30f49c31f3
commit a867e1979a
5 changed files with 45 additions and 2 deletions

2
.gitignore vendored
View File

@ -130,3 +130,5 @@ dist
.yarn/install-state.gz
.pnp.*
.env

View File

@ -1,3 +1,5 @@
# SquodAdmin
Squog Administrator and Fun Bot made in Node
## Squog Administrator and Fun Discord Bot made in Node
## Code will be open after we get this one done

5
events/base.js Normal file
View File

@ -0,0 +1,5 @@
const client = require("../index")
client.on("ready", () => {
console.log(`Bot ready as ${client.user.username}`)
})

33
index.js Normal file
View File

@ -0,0 +1,33 @@
// 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)

View File

@ -15,5 +15,6 @@
},
"dependencies": {
"discord.js": "^14.19.3"
}
},
"module": "true"
}