forked from embee/woomy
maybe we can just check everything in config
This commit is contained in:
parent
19e8c4e744
commit
529744f5d5
2 changed files with 14 additions and 21 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
||||||
.env
|
config.js
|
||||||
node_modules
|
node_modules
|
||||||
data
|
|
30
index.js
30
index.js
|
@ -17,15 +17,15 @@ const client = new Discord.Client({ disabledEvents: ['TYPING_START'] })
|
||||||
// Logger
|
// Logger
|
||||||
client.logger = require('tracer').colorConsole({
|
client.logger = require('tracer').colorConsole({
|
||||||
format: [
|
format: [
|
||||||
'{{timestamp}} [{{title}}] {{file}}: {{message}}',
|
'{{timestamp}} | {{title}} | {{file}}:{{line}} | {{message}}',
|
||||||
{
|
{
|
||||||
debug: `{{timestamp}} ${'<{{title}}>'.magenta} {{file}}:{{line}} {{message}}`,
|
debug: `{{timestamp}} | ${'{{title}}'.magenta} | {{file}}:{{line}} | {{message}}`,
|
||||||
log: `{{timestamp}} ${'<{{title}}>'.white} {{file}}:{{line}} {{message}}`,
|
log: `{{timestamp}} | ${'{{title}}'.white} | {{file}}:{{line}} | {{message}}`,
|
||||||
info: `{{timestamp}} ${'<{{title}}>'.cyan} {{file}}:{{line}} {{message}}`,
|
info: `{{timestamp}} | ${'{{title}}'.cyan} | {{file}}:{{line}} | {{message}}`,
|
||||||
ready: `{{timestamp}} ${'<{{title}}>'.green} {{file}}:{{line}} {{message}}`,
|
ready: `{{timestamp}} | ${'{{title}}'.green} | {{file}}:{{line}} | {{message}}`,
|
||||||
warn: `{{timestamp}} ${'<{{title}}>'.yellow} {{file}}:{{line}} {{message}}`,
|
warn: `{{timestamp}} | ${'{{title}}'.yellow} | {{file}}:{{line}} | {{message}}`,
|
||||||
error: `{{timestamp}} ${'<{{title}}>'.red} {{file}}:{{line}} {{message}}`,
|
error: `{{timestamp}} | ${'{{title}}'.red} | {{file}}:{{line}} | {{message}}`,
|
||||||
fatal: `{{timestamp}} ${'<{{title}}>'.red.bold} {{file}}:{{line}} {{message}}`
|
fatal: `{{timestamp}} | ${'{{title}}'.red.bold} | {{file}}:{{line}} | {{message}}`
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dateformat: 'yyyy-mm-dd"T"HH:MM:ss',
|
dateformat: 'yyyy-mm-dd"T"HH:MM:ss',
|
||||||
|
@ -33,19 +33,13 @@ client.logger = require('tracer').colorConsole({
|
||||||
filters: [colors.white]
|
filters: [colors.white]
|
||||||
})
|
})
|
||||||
|
|
||||||
// Checks to make sure config.js and .env exist
|
// Check to make sure config exists
|
||||||
if (fs.existsSync('./.env') === false) {
|
|
||||||
client.logger.fatal('The .env file is missing! Please create a .env file.')
|
|
||||||
process.exit()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fs.existsSync('./config.js') === false) {
|
if (fs.existsSync('./config.js') === false) {
|
||||||
client.logger.fatal('The config.js file is missing! Please create a config.js file.')
|
client.logger.fatal('The config.js file is missing! Please create a config.js file.')
|
||||||
process.exit()
|
process.exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
client.config = require('./config')
|
client.config = require('./config')
|
||||||
require('dotenv').config()
|
|
||||||
require('./modules/functions')(client)
|
require('./modules/functions')(client)
|
||||||
require('./modules/music')(client)
|
require('./modules/music')(client)
|
||||||
require('./modules/botlists')(client)
|
require('./modules/botlists')(client)
|
||||||
|
@ -106,10 +100,10 @@ const init = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log into Discord
|
// Log into Discord
|
||||||
if (client.devmode === true) {
|
if (client.devmode !== true) {
|
||||||
client.login(process.env.DEVTOKEN)
|
client.login(client.config.token)
|
||||||
} else {
|
} else {
|
||||||
client.login(process.env.TOKEN)
|
client.login(client.config.token_dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue