This repository has been archived by the owner on Mar 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
55 lines (49 loc) · 1.89 KB
/
bot.js
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
52
53
54
55
require('dotenv').config()
const Discord = require('discord.js')
const fs = require('fs')
const klaw = require('klaw')
const path = require('path')
const sqlite = require('sqlite3')
const client = new Discord.Client({
disableEveryone: true,
disabledEvents: ['TYPING_START', 'GUILD_INTEGRATIONS_UPDATE', 'USER_NOTE_UPDATE', 'USER_SETTINGS_UPDATE', 'GUILD_MEMBER_ADD', 'CHANNEL_PINS_UPDATE', 'GUILD_BAN_ADD', 'GUILD_BAN_REMOVE', 'PRESENCE_UPDATE']
})
client.config = require('./config.json')
client.commands = new Map()
client.aliases = new Map()
client.db = new sqlite.Database('./db/mom.db', err => {
if(err) console.error(err.message)
})
client.msgcooldown = new Set()
require('./utils.js')(client)
client.queue = new Map()
client.snipeMap = new Map()
client.slotSet = new Set()
client.cooldowns = new Map()
const start = async () => {
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
klaw("./commands").on("data", (item) => {
const cmdFile = path.parse(item.path);
if (!cmdFile.ext || cmdFile.ext !== ".js") return;
try {
let props = require(`${cmdFile.dir}${path.sep}${cmdFile.name}${cmdFile.ext}`)
// console.log(`Loading Command: ${props.help.name}`)
client.commands.set(props.help.name, props)
if (props.help.aliases) props.help.aliases.forEach(alias => {
client.aliases.set(alias, props)
});
} catch (e) {
return console.log(new Error(`FAIL: ${cmdFile.name}: ${e.stack}`))
};
});
// console.log('I am prepared to decimate them weebs with my otaku-desu status ÒwÓ')
client.login(process.env.BOT_TOKEN)
}
start()