| 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); |