© 2026 Hedgehog Software, LLC
import dotenv from 'dotenv'; import { ShardingManager } from 'discord.js'; dotenv.config(); const manager = new ShardingManager('./src/bot.js', { token: process.env.DISCORD_BOT_TOKEN, respawn: true, // Automatically respawn shards if they fail timeout: 120_000 // Increase timeout to 120 seconds }); manager.on('shardCreate', shard => { console.log(`Launched shard ${shard.id}`); }); manager.spawn({ delay: 5000 }) // Adds a 5-second delay between shards .then(() => console.log('All shards launched successfully.')) .catch(error => console.error('Error while spawning shards:', error));
Join the Discord to ask follow-up questions and connect with the community
Support server for discord.js, a Node.js module to interact with Discord's apps API.
57,666 Members