_yaimsputnik5
DIAdiscord.js - Imagine an app
•Created by _yaimsputnik5 on 10/2/2024 in #djs-questions
sharding with workers
const bot = new Client({
shards: "auto",
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
},
channels: {
interval: 2700,
lifetime: 1200,
filter: () => channel => true
},
guildChannels: {
interval: 2700,
lifetime: 1200,
filter: () => channel => true
},
roles: {
interval: 2700,
lifetime: 1200,
filter: () => role => true
},
guilds: {
interval: 2700,
lifetime: 1200,
filter: () => guild => true
},
permissionOverwrites: {
interval: 2700,
lifetime: 1200,
filter: () => permissionOverwrite => true
},
voiceStates: {
interval: 2700,
lifetime: 1200,
filter: () => voiceState => true
}
}
});
const bot = new Client({
shards: "auto",
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
},
channels: {
interval: 2700,
lifetime: 1200,
filter: () => channel => true
},
guildChannels: {
interval: 2700,
lifetime: 1200,
filter: () => channel => true
},
roles: {
interval: 2700,
lifetime: 1200,
filter: () => role => true
},
guilds: {
interval: 2700,
lifetime: 1200,
filter: () => guild => true
},
permissionOverwrites: {
interval: 2700,
lifetime: 1200,
filter: () => permissionOverwrite => true
},
voiceStates: {
interval: 2700,
lifetime: 1200,
filter: () => voiceState => true
}
}
});
11 replies