This commit is contained in:
Lukáš Horáček 2020-03-31 13:40:51 +02:00
parent 9180cf1d17
commit c570f549e5
No known key found for this signature in database
GPG key ID: E07D6630DBC17195

View file

@ -7,15 +7,12 @@ if (Number(process.version.slice(1).split('.')[0]) < 12) {
process.exit() process.exit()
} }
// Load environment variables / config // Libraries
const fs = require('fs') const fs = require('fs')
const colors = require('colors') const colors = require('colors')
const Discord = require('discord.js') const Discord = require('discord.js')
const client = new Discord.Client({ disabledEvents: ['TYPING_START'] }) const client = new Discord.Client({ disabledEvents: ['TYPING_START'] })
// Load functions module
require('./modules/functions')(client)
// Logger // Logger
client.logger = require('tracer').colorConsole({ client.logger = require('tracer').colorConsole({
format: [ format: [
@ -52,6 +49,9 @@ if (fs.existsSync('./config.js') === false) {
require('dotenv').config() require('dotenv').config()
client.config = require('./config') client.config = require('./config')
// Load functions module
require('./modules/functions')(client)
// Command/alias cache // Command/alias cache
client.commands = new Discord.Collection() client.commands = new Discord.Collection()
client.cooldown = new Discord.Collection() client.cooldown = new Discord.Collection()
@ -62,7 +62,9 @@ const init = async () => {
// Load events // Load events
fs.readdir('./events', (err, files) => { fs.readdir('./events', (err, files) => {
if (err) { if (err) {
client.logger.error('Failed to get files in events directory! ' + err); client.logger.fatal('Failed to get files in events directory! ' + err);
process.exit();
return; return;
}; };
@ -80,7 +82,9 @@ const init = async () => {
// Load commands // Load commands
fs.readdir('./commands', (err, files) => { fs.readdir('./commands', (err, files) => {
if (err) { if (err) {
client.logger.error('Failed to get files in commands directory! ' + err); client.logger.fatal('Failed to get files in commands directory! ' + err);
process.exit();
return; return;
}; };