This repository has been archived by the owner on Mar 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.js
66 lines (59 loc) · 1.88 KB
/
app.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
global.Promise = require("bluebird");
global.cluster = require('cluster');
const fs = require('fs');
const { Webpanel } = require('./webpanel/Webpanel.js');
const Sharder = require('./sharding/ShardingManager');
const { sendWorker:webhook } = require('./util/webhook.js');
const config = JSON.parse(fs.readFileSync('./data/config.json', 'utf-8'));
require('./sharding/OutputHandler');
const sharder = new Sharder(config.bot.token, `${__dirname}/bot/Hawk.js`, {
disableEvents: { TYPING_START: true },
messageLimit: 0,
defaultImageFormat: "png",
defaultImageSize: 256
});
sharder.on('workerStarted', worker => {
webhook({
author: {
name: `Launched #${worker.id}`,
icon_url: 'https://cdn.discordapp.com/icons/457992291001303041/ccf0a32ae94a37f5a1e1ccc7e81fb1c9.png'
},
color: 0x37b739,
fields: [
{
name: 'Total Shards',
value: `Count: ${worker.shardsPerWorker}`,
inline: true,
},
{
name: 'Shards on Worker',
value: `Total ${worker.shardStart}-${worker.shardEnd}`,
inline: true
}
]
});
});
sharder.on('workerReboot', worker => {
webhook({
author: {
name: `Rebooted #${worker.id}`,
icon_url: 'https://cdn.discordapp.com/icons/457992291001303041/ccf0a32ae94a37f5a1e1ccc7e81fb1c9.png'
},
color: 0x37b739,
fields: [
{
name: 'Total Shards',
value: `Count: ${worker.shardsPerWorker}`,
inline: true,
},
{
name: 'Shards on Worker',
value: `Total ${worker.shardStart}-${worker.shardEnd}`,
inline: true
}
]
});
});
sharder.launch();
if(cluster.isMaster)
new Webpanel(sharder);