_yaimsputnik5
_yaimsputnik5
DIAdiscord.js - Imagine an app
Created by _yaimsputnik5 on 10/2/2024 in #djs-questions
sharding with workers
Well one worker per shard is fine right? also i dont need to make another file or something, this is all?
11 replies
DIAdiscord.js - Imagine an app
Created by _yaimsputnik5 on 10/2/2024 in #djs-questions
sharding with workers
That's all i need to modify for this to work?
11 replies
DIAdiscord.js - Imagine an app
Created by _yaimsputnik5 on 10/2/2024 in #djs-questions
sharding with workers
So this would be correct right?:
const bot = new Client({
shards: "auto",

ws: {
buildStrategy: (manager) => new WorkerShardingStrategy(manager, { shardsPerWorker: 2 })
},

intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages
],

presence: {
status: 'online',
activities: [{ name: '/help', type: ActivityType.Listening }],
},

makeCache: (manager) => {
if (necessaryManagers.includes(manager.name)) {
return new Collection();
}

if (userRelatedManagers.includes(manager.name)) {
return new Collection();
}

return new LimitedCollection({ maxSize: 0 });
},

sweepers: {
guildMembers: {
interval: 2700,
lifetime: 1200,
filter: () => member => member.id !== bot.user.id
},
users: {
interval: 2700,
lifetime: 1200,
filter: () => member => member.id !== bot.user.id
},
permissionOverwrites: {
interval: 2700,
lifetime: 1200,
filter: () => permissionOverwrite => true
},
voiceStates: {
interval: 2700,
lifetime: 1200,
filter: () => voiceState => true
}
}
});
const bot = new Client({
shards: "auto",

ws: {
buildStrategy: (manager) => new WorkerShardingStrategy(manager, { shardsPerWorker: 2 })
},

intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages
],

presence: {
status: 'online',
activities: [{ name: '/help', type: ActivityType.Listening }],
},

makeCache: (manager) => {
if (necessaryManagers.includes(manager.name)) {
return new Collection();
}

if (userRelatedManagers.includes(manager.name)) {
return new Collection();
}

return new LimitedCollection({ maxSize: 0 });
},

sweepers: {
guildMembers: {
interval: 2700,
lifetime: 1200,
filter: () => member => member.id !== bot.user.id
},
users: {
interval: 2700,
lifetime: 1200,
filter: () => member => member.id !== bot.user.id
},
permissionOverwrites: {
interval: 2700,
lifetime: 1200,
filter: () => permissionOverwrite => true
},
voiceStates: {
interval: 2700,
lifetime: 1200,
filter: () => voiceState => true
}
}
});
11 replies