This repository was archived by the owner on Jun 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathindex.js
More file actions
58 lines (45 loc) · 1.4 KB
/
index.js
File metadata and controls
58 lines (45 loc) · 1.4 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
/**
* Bootstraps Atlas begins startup
*
* Previously a sharder handler would do this, but now Atlas has gotten it's big boy pants on and a sharder manager isn't needed.
* This is essentially just calling Atlas with an Eris client
*/
const logger = require('atlas-lib/lib/logger');
// load environment variables from ./.env
require('dotenv').config();
logger.config(true);
const Eris = require('eris');
const Atlas = require('./Atlas');
const autoscale = require('./src/autoscale');
(async () => {
const { total, mine } = await autoscale();
console.log(`Shard ${mine}, total ${total}`);
const client = new Eris.Client(process.env.TOKEN, {
// atlas uses rest mode for fetching users from ID's, among other things
restMode: true,
// performance reasons
disableEvents: {
TYPING_START: true,
USER_NOTE_UPDATE: true,
RELATIONSHIP_ADD: true,
RELATIONSHIP_REMOVE: true,
},
// transparent avatars look gross with the default jpg format
defaultImageFormat: 'png',
// for embed thumbnails it looks kinda gross <256
defaultImageSize: 256,
maxShards: total,
firstShardID: mine,
lastShardID: mine,
});
const ogEmit = client.emit;
client.emit = function emit(evtname, ...args) {
if (evtname !== 'presenceUpdate') {
console.log(`Event ${evtname}`);
}
return ogEmit.call(this, evtname, ...args);
};
const atlas = new Atlas({ client });
atlas.launch();
client.connect();
})();