blob: 86430e198ed2648a09d82e687acd6396deccb304 [file] [log] [blame]
const {
Client,
GatewayIntentBits
} = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.DirectMessages,
],
});
require("dotenv").config({
path: "config/.env"
});
require('./utils/functions')(client);
client.mongoose = require('./utils/mongoose');
client.on('ready', () => {
console.log(`Starting Server`);
const webPortal = require('./server');
webPortal.load(client);
});
// Listening for error & warn events.
client.on("error", console.error);
client.on("warn", console.warn);
process.on('unhandledRejection', error => {
console.error('Unhandled promise rejection:', error);
});
process.on('uncaughtException', function (err) {
console.log('Caught exception: ' + err);
});
client.mongoose.init();
client.login(process.env.TOKEN);