Discord shards problem

Can someone help m with that ? Hello i just asking for help for this Shards problem.
const { ShardingManager } = require('discord.js');

const manager = new ShardingManager('./index.js', {
  token: bottoken,
  totalShards: 'auto',
  respawn: true,
  readyTimeout: 240000, // Increase timeout to 10 minutes
});

manager.on('shardCreate', shard => {
  console.log(`Launched shard ${shard.id}`);

  shard.on('reconnecting', () => {
    console.log(`Reconnecting shard: [${shard.id}]`);
  });

  shard.on('spawn', () => {
    console.log(`Spawned shard: [${shard.id}]`);
  });

  shard.on('ready', () => {
    const endTime = Date.now();
    console.log(`Shard [${shard.id}] is ready after ${endTime - shard.launchTime}ms`);
  });

  shard.on('death', () => {
    console.log(`Died shard: [${shard.id}]`);
  });

  shard.on('error', (err) => {
    console.log(`Error in [${shard.id}] with: ${err}`);
    shard.respawn();
  });

  shard.launchTime = Date.now();
});

manager.spawn({ amount: 'auto', delay: 60000, timeout: 120000 }) // Increased delay and timeout
  .catch(console.error);

const ShardingManager = require("./shards.js");
const client = new Client({
    intents: [
       Intents.FLAGS.GUILDS,
       Intents.FLAGS.GUILD_MEMBERS,
       Intents.FLAGS.GUILD_BANS,
       Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
       Intents.FLAGS.GUILD_INTEGRATIONS,
       Intents.FLAGS.GUILD_WEBHOOKS,
       Intents.FLAGS.GUILD_INVITES,
       Intents.FLAGS.GUILD_VOICE_STATES,
        Intents.FLAGS.GUILD_PRESENCES,
        Intents.FLAGS.GUILD_MESSAGES,
        Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
        Intents.FLAGS.GUILD_MESSAGE_TYPING,
        Intents.FLAGS.DIRECT_MESSAGES,
        Intents.FLAGS.DIRECT_MESSAGE_REACTIONS,
        Intents.FLAGS.DIRECT_MESSAGE_TYPING,
    ],
shards: "auto"
});

The code launch same shard four times then kill the project
Was this page helpful?