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:
parent
30f49c31f3
commit
a867e1979a
2
.gitignore
vendored
2
.gitignore
vendored
@ -130,3 +130,5 @@ dist
|
|||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
|
||||||
|
.env
|
@ -1,3 +1,5 @@
|
|||||||
# SquodAdmin
|
# 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
5
events/base.js
Normal 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
33
index.js
Normal 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)
|
@ -15,5 +15,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^14.19.3"
|
"discord.js": "^14.19.3"
|
||||||
}
|
},
|
||||||
|
"module": "true"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user