-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (34 loc) · 1.14 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const { Client, GatewayIntentBits, Collection } = require('discord.js');
const { loadCommands, loadEvents } = require('./helpers/load');
const connectDB = require('./mongodb-connect')
const app = require('./web-dashboard/app')
const log = require('log-to-file');
require('dotenv').config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildVoiceStates
],
});
client.commands = new Collection()
const port = process.env.PORT || 5000
app.set('client', client)
client.on("ready", async () => {
client.user.setActivity('Use /help for help.');
console.log('bot is ready...')
loadCommands(client)
loadEvents(client)
});
process.on('uncaughtException', function (error) {
log(`Time: ${new Date}\n${error}\n`, 'error.log');
console.log(new Date, error)
});
process.on('unhandledRejection', error => {
log(`Time: ${new Date}\n${error}\n`, 'error.log');
console.log(new Date, error)
});
connectDB()
client.login(process.env.TOKEN);
app.listen(port || 5000, () => console.log(`listening on port ${port}...`));
module.exports = client