-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
71 lines (64 loc) · 2.04 KB
/
Copy pathindex.js
File metadata and controls
71 lines (64 loc) · 2.04 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
const { PrismaClient } = require("@prisma/client");
const { Client, Collection, Events, GatewayIntentBits, Options } = require("discord.js");
const token = process.env.BOT_TOKEN;
const prisma = new PrismaClient();
module.exports = { prisma };
const client = new Client({
closeTimeout: 3_000,
waitGuildTimeout: 15_000,
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildModeration,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.MessageContent
],
allowedMentions: {
parse: ["roles", "users"],
repliedUser: true
},
makeCache: Options.cacheWithLimits({
...Options.DefaultMakeCacheSettings,
ReactionManager: 0,
GuildMemberManager: {
maxSize: 200,
keepOverLimit: member => member.id === client.user.id,
}
}),
});
client.settings = {
name: "settings",
fetchAll: false,
autoFetch: true,
cloneLevel: "deep"
};
client.commands = new Collection();
client.aliases = new Collection();
client.cooldowns = new Collection();
client.logger = require('./Utils/logger');
client.resolver = require('./Utils/resolver');
client.prisma = prisma;
(async () => {
try {
client.logger.log("Connecting to database...", "info");
await client.prisma.$connect();
client.logger.log("Connected to database.", "info");
["commands", "events"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
client.on('error', error => client.logger.log(error, "error"));
client.on('warn', info => client.logger.log(info, "warn"));
process.on('unhandledRejection', error => client.logger.log("UNHANDLED_REJECTION\n" + error, "error"));
process.on('uncaughtException', error => {
client.logger.log("UNCAUGHT_EXCEPTION\n" + error, "error");
client.logger.log("Uncaught Exception is detected, restarting...", "info");
process.exit(1);
});
client.login(token).catch((err) => { client.logger.log(err, "error") });
} catch (error) {
client.logger.log(error, "error");
}
})();