-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
46 lines (32 loc) · 1.02 KB
/
index.js
File metadata and controls
46 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const path = require('path')
const fs = require('fs')
const Discord = require('discord.js')
const client = new Discord.Client()
const config = require('./config.json')
const { O_DIRECTORY } = require('constants')
client.on('ready', () => {
console.log('The bot is online!')
const baseFile = 'command-base.js'
const commandBase = require(`./commands/${baseFile}`)
const readCommands = dir => {
const files = fs.readdirSync(path.join(__dirname, dir))
for (const file of files) {
const stat = fs.lstatSync(path.join(__dirname, dir, file))
if (stat.isDirectory()) {
readCommands(path.join(dir, file))
} else if (file !== baseFile) {
const option = require(path.join(__dirname, dir, file))
commandBase(client, option)
}
}
}
readCommands('commands')
client.user.setPresence({
game: {
name: 'Improving',
type: 'WATCHING'
},
status: 'Online'
})
})
client.login(process.env.DJS_TOKEN)