-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
76 lines (69 loc) · 2.22 KB
/
index.ts
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
const { Client, Message, MessageEmbed, WebhookClient, Collection } = require('discord.js');
// require('dotenv').config();
const { token, defaultPrefix, webhook_ID, webhook_Secret } = require('./configs/bot.json');
const colors = require('colors');
const fs = require('fs');
const ee = require('./configs/embed.json');
const config = require('./configs/config.json');
// const Keyv = require('keyv');
// const keyv = new Keyv(`mongodb://${process.env.MONGOUSER}:${process.env.MONGOPASSWORD}@${process.env.MONGOHOST}:${process.env.MONGOPORT}`, { collection: 'userBans' });
const client = new Client({
messageCacheLifetime: 60,
fetchAllMembers: false,
messageCacheMaxSize: 10,
restTimeOffset: 0,
restWsBridgetimeout: 100,
shards: 'auto',
// shardCount: "1",
allowedMentions: {
parse: ['roles', 'users', 'everyone'],
repliedUser: true,
},
partials: [
'MESSAGE',
'CHANNEL',
'REACTION',
],
intents: [
'GUILDS',
'GUILD_MEMBERS',
'GUILD_BANS',
'GUILD_EMOJIS_AND_STICKERS',
'GUILD_WEBHOOKS',
'GUILD_MESSAGES',
'GUILD_MESSAGE_REACTIONS',
'GUILD_MESSAGE_TYPING',
'DIRECT_MESSAGES',
'MESSAGE_CONTENT',
],
});
module.exports = client;
const Errorhandler = require('discord-error-handler');
/* const handle = new Errorhandler(client, {
webhook: { id: process.env.webhook_ID, token: process.env.webhook_Secret },
}); */
const handle = new Errorhandler(client, {
webhook: { id: webhook_ID, token: webhook_Secret },
});
client.commands = new Collection();
client.aliases = new Collection();
client.events = new Collection();
client.cooldowns = new Collection();
client.slashCommands = new Collection();
client.categories = fs.readdirSync('./commands/');
['command.ts', 'event.ts', 'slash.ts'].forEach((handler) => {
require(`./handlers/${handler}`)(client);
});
client.login(token);
process.on("unhandledRejection", (reason, p) => {
console.log(reason, p),
handle.createrr(client, undefined, undefined, reason, p);
});
process.on("uncaughtException", (err, origin) => {
console.log(err, origin),
handle.createrr(client, undefined, undefined, err, origin);
});
process.on("multipleResolves", (type, promise, reason) => {
console.log(type, promise, reason),
handle.createrr(client, undefined, undefined, type, promise, reason);
});