Files
PteroStats/index.js
mrxbox98 cdfbe9b140 Fixed chalk not being imported
This would throw an error before as chalk was not imported
2021-08-09 21:42:43 -07:00

20 lines
741 B
JavaScript

const { Client, Collection } = require('discord.js')
const fs = require('fs')
const client = new Client()
const yaml = require('js-yaml')
const chalk = require('chalk')
const config = yaml.load(fs.readFileSync('./config.yml', 'utf8'))
client.config = config
fs.readdir('./events/', (err, files) => {
if (err) return console.error(err)
files.forEach(file => {
const event = require(`./events/${file}`)
const eventName = file.split('.')[0]
client.on(eventName, event.bind(null, client))
})
})
if (config.token === 'BOT TOKEN') console.log(chalk.blue('[PteroStats Checker] ') + chalk.red('Invalid Token, Check ') + chalk.green('config.yml') + chalk.red(' file to change token'))
client.login(config.token)