Xenon
DIAdiscord.js - Imagine an app
•Created by Xenon on 10/1/2024 in #djs-questions
help meeded
code-
5 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
Error on ticketing bot
index.js
https://pastebin.com/UQRaAweU
8 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
Error on ticketing bot
https://pastebin.com/z1AZftFL
ticket.js
8 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
Error on ticketing bot
8 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
ok
12 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
then how to resolve this?
12 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
this error is faced by me
12 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
12 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
please help me
12 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
ok
12 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
12 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
bot.js
12 replies
DIAdiscord.js - Imagine an app
•Created by Xenon on 8/14/2024 in #djs-questions
error in sharding
index.js
const { ShardingManager } = require('discord.js');
const dotenv = require('dotenv');
dotenv.config();
const totalClusters = 2;
const totalShards = 10;
// Initialize the ShardingManager
const manager = new ShardingManager('./bot.js', {
token: process.env.TOKEN,
totalShards: totalShards,
});
// Event listeners for shard lifecycle events
manager.on('shardCreate', shard => {
const clusterID = Math.floor(shard.id / Math.ceil(totalShards / totalClusters));
console.log(
[ SHARD ] Shard ${shard.id} in cluster ${clusterID} is deployed
);
shard.on('ready', () => {
console.log([ SHARD ] Shard ${shard.id} is ready
);
});
shard.on('error', error => {
console.error([ SHARD ERROR ] Shard ${shard.id} encountered an error:
, error);
});
shard.on('disconnect', () => {
console.log([ SHARD ] Shard ${shard.id} disconnected
);
});
shard.on('reconnecting', () => {
console.log([ SHARD ] Shard ${shard.id} is reconnecting
);
});
shard.on('death', process => {
console.log([ SHARD ] Shard ${shard.id} process exited with code ${process.exitCode}
);
});
});
// Spawn the shards with a delay of 5 seconds between each spawn
manager.spawn({
amount: totalShards,
delay: 5000
}).catch(error => {
console.error('Error spawning shards:', error);
});12 replies