From 4c51956f59ad36b50ccd9462c7c8eaca60fe3dc2 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Tue, 26 Sep 2023 08:42:09 -0700 Subject: [PATCH] update/allow sharding --- bot.js | 6 ++++++ index.js | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 bot.js diff --git a/bot.js b/bot.js new file mode 100644 index 0000000..8f31a3d --- /dev/null +++ b/bot.js @@ -0,0 +1,6 @@ +const LinesPoliceCadBot = require('./structures/LinesPoliceCadBot'); +const { GatewayIntentBits } = require('discord.js'); +const config = require('./config/config'); + +let client = new LinesPoliceCadBot({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] }, config); +client.build() diff --git a/index.js b/index.js index 8f31a3d..2ce095a 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,8 @@ -const LinesPoliceCadBot = require('./structures/LinesPoliceCadBot'); -const { GatewayIntentBits } = require('discord.js'); +const { ShardingManager } = require('discord.js'); const config = require('./config/config'); -let client = new LinesPoliceCadBot({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] }, config); -client.build() +const manager = new ShardingManager('./bot.js', { token: config.Token }); + +manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`)); + +manager.spawn();