This repository was archived by the owner on Apr 26, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
51 lines (40 loc) · 1.25 KB
/
app.js
File metadata and controls
51 lines (40 loc) · 1.25 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
47
48
49
50
51
/*
@document : app.js
@author : Thomas Bnt <thomasbnt@protonmail.com>
@version : 1.1.0
@copyright : 2020, Thomas Bnt
@license : GNU General Public License v3.0
@repository : https://github.com/lahype/DefaultCommandHandler
*/
const Discord = require('discord.js')
const Enmap = require('enmap')
const fs = require('fs')
const config = require('./config.json')
const bot = new Discord.Client({
autoReconnect: true
})
// -------------------- Config --------------------
bot.config = config
bot.commands = new Enmap()
bot.updatePresence = function updatePresence() {
bot.user.setActivity("my custom status", { type: "WATCHING" })
}
// -------------------- My C0re --------------------
fs.readdir('./events/', (err, files) => {
if (err) return console.error(err)
files.forEach(file => {
const event = require(`./events/${file}`)
let eventName = file.split('.')[0]
bot.on(eventName, event.bind(null, bot))
})
})
fs.readdir('./commands/', (err, files) => {
if (err) return console.error(err)
files.forEach(file => {
if (!file.endsWith('.js')) return
let props = require(`./commands/${file}`)
let commandName = file.split('.')[0]
bot.commands.set(commandName, props)
})
})
bot.login(config.token)