forked from Exium1/UnoBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
71 lines (62 loc) · 1.9 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
const { isMaster } = require("cluster");
const { Fleet } = require("eris-fleet");
const path = require("path");
const { inspect } = require("util");
const { botToken, shardCount, topggToken, topggAutoPostStats } = require("./utils/config.js");
const options = {
path: path.join(__dirname, "./bot.js"), // eslint-disable-line
token: botToken,
shards: shardCount,
statsInterval: 18e5, // 1800000 ms - 30 mins
clientOptions: {
messageLimit: 20,
defaultImageFormat: "png",
disableEvents: {
GUILD_BAN_ADD: true,
GUILD_BAN_REMOVE: true,
GUILD_MEMBER_ADD: true,
GUILD_MEMBER_REMOVE: true,
GUILD_MEMBER_UPDATE: true,
GUILD_ROLE_CREATE: true,
GUILD_ROLE_DELETE: true,
MESSAGE_DELETE: true,
MESSAGE_DELETE_BULK: true,
PRESENCE_UPDATE: true,
TYPING_START: true,
USER_UPDATE: true,
VOICE_STATE_UPDATE: true
},
allowedMentions: {
everyone: false,
roles: false,
users: true,
repliedUser: true
},
guildSubscriptions: false,
intents: ["guilds", "guildMessages", "guildMessageReactions", "directMessages", "directMessageReactions"]
}
};
const Admiral = new Fleet(options);
if (isMaster) {
Admiral.on("log", (m) => console.log(m));
Admiral.on("debug", (m) => console.debug(m));
Admiral.on("warn", (m) => console.warn(m));
Admiral.on("error", (m) => console.error(inspect(m)));
Admiral.on("stats", async (stats) => {
var statsString = `Running ${stats.guilds} guilds, ${stats.members} members, and ${shardCount} shards.`;
console.log("Cluster Manager - ", statsString);
if (topggToken && topggAutoPostStats) {
const Topgg = require("@top-gg/sdk");
const topggApi = new Topgg.Api(topggToken);
await topggApi.postStats({
serverCount: stats.guilds,
shardCount: shardCount
});
console.log(`Posted stats to Top.gg.`);
}
});
var { updateUserRanks } = require("./utils/functions");
setInterval(async () => {
await updateUserRanks();
}, 43200000);
}