-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
74 lines (65 loc) · 2.23 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
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
const { create } = require('@open-wa/wa-automate');
const Util = require('./handler/Util');
const { Kusonime, Samehadaku, Otakudesu } = require('./plugin/anime');
const { Komikindo } = require('./plugin/manga');
const { Collection } = require('@discordjs/collection');
const KuromojiAnalyzer = require("kuroshiro-analyzer-kuromoji");
const Kuroshiro = require("@dsquare-gbu/kuroshiro");
const kuroshiro = new Kuroshiro();
const Giveaway = require('./plugin/Giveaway');
const start = async (client) => {
await kuroshiro.init(new KuromojiAnalyzer());
require('./handler/module.js')(client);
require('./handler/events.js')(client);
client.config = require('./config.json');
client.commands = new Collection();
client.cooldown = new Collection();
client.aliases = new Collection();
client.recent = new Set();
client.util = new Util();
client.package = require('./package.json');
client.kusonime = new Kusonime(client);
client.samehadaku = new Samehadaku(client);
client.otakudesu = new Otakudesu(client);
client.komikindo = new Komikindo(client);
client.kuroshiro = kuroshiro;
client.giveaway = new Giveaway(client);
require('./database/index')(client.config.db);
}
process.on("unhandledRejection", (reason, promise) => {
console.error("Unhandled Rejection at:", reason.stack || reason);
console.error(reason);
});
process.on("uncaughtException", err => {
console.error(new Date());
console.error(`Caught exception: ${err}`);
console.error(err);
if (err.code == "PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR") {
console.error("true");
}
});
const options = {
sessionId: 'Kato',
headless: true,
qrTimeout: 0,
authTimeout: 0,
restartOnCrash: start,
cacheEnabled: false,
useChrome: true,
killProcessOnBrowserClose: true,
throwErrorOnTosBlock: false,
chromiumArgs: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--aggressive-cache-discard',
'--disable-cache',
'--disable-application-cache',
'--disable-offline-load-stale-cache',
'--disk-cache-size=0'
],
eventMode: true,
multiDevice: true,
};
create(options)
.then((client) => start(client))
.catch((err) => new Error(err));