forked from LendaDeAfonselio/Alarm_Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
18 lines (14 loc) · 645 Bytes
/
index.js
File metadata and controls
18 lines (14 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const { ShardingManager } = require('discord.js');
const appsettings = require('./appsettings.json');
const shards = new ShardingManager('./bot.js', {
totalShards: 'auto', // this value should always be 'auto', if its a number it should only be used for testing
token: appsettings.token,
execArgv: ['--trace-warnings'],
});
shards.on('shardCreate', async (shard) => {
shard.on("ready", () => {
console.log(`New shard with id ${shard.id}`);
shard.send({ type: "shardId", data: { shardId: shard.id } });
});
});
shards.spawn().catch(error => console.error(`[ERROR/SHARD] Shard failed to spawn.\n${error}`));