-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
89 lines (61 loc) · 2.92 KB
/
Copy pathindex.js
File metadata and controls
89 lines (61 loc) · 2.92 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const start = async (args = {}) => {
const path = require('path');
const fs = require('fs');
require('./src/start-up/update-console-log');
require('./src/start-up/process-exit');
const Constants = require('./data/constants');
const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');
const dotenv = require('dotenv');
global.isDevelopment = fs.existsSync(path.join(__dirname, '.dev'));
dotenv.config({ path: global.isDevelopment ? Constants.NODE.ENV.DEVELOPMENT : Constants.NODE.ENV.PRODUCTION });
global.mainDir = __dirname;
global.mongoClient = null;
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.GuildScheduledEvents,
GatewayIntentBits.GuildMessageReactions,
], partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction
]
});
client.setMaxListeners(Constants.NODE.DC_CLIENT.EVENTS.UNLIMITED_LISTENERS);
client.startDate = Date.now();
require('./src/dc-client/load-languages').load(client);
require('./src/dc-client/language-file-check');
await require('./src/start-up/mongo-setup').connect();
if (args.withPuppeteer) require('./src/start-up/start-puppeteer');
require('./src/web-server/http-server').setup(client);
client.once(Events.ClientReady, readyClient => {
require('./src/dc-guild/fetch-channels').fetch(client);
require('./src/interactions/load-interactions').load(client);
require('./src/start-up/mongodb-check');
require('./src/dc-client/client-status').start(client);
require('./src/dc-guild/stats-message').start(client); // user message stats
require('./src/dc-guild/stats-voice-channel').start(client); // user voice stats
require('./src/dc-guild/guild-stats-tracker').start(client); // yearly review on Discord activity (Global)
require('./src/dc-guild/webhook-commit-filter').start(client);
require('./src/dc-guild/invite-tracker').start(client);
require('./src/dc-guild/channel-auto-slowmo').start(client);
require('./src/dc-guild/git-rank').setup(client);
require('./src/dc-guild/event-prereminder').setupEventMessages(client);
require('./src/start-up/mongodb-temp-table-helper').start();
console.log(`[Discord::Client] CodeZero Discord Client ready => ${readyClient.user.tag}`, Constants.CONSOLE.GOOD);
});
require('./src/dc-client/debug-log').setup(client);
client.login(process.env.TOKEN);
};
start(
{
// withPuppeteer: true
}
);