I have an application that delivery (now) 230 bots with same source code, the idea is to make code as generic as possible and keep it health to host. Your lib is helping me a lot, but I'm having problem to make shard works in automatic mode. Maybe there is a way to use ShardManager, but I would have to check which bot needs Shards or not, and rewrite a big part of the struct code (which isn't a problem, but maybe it doesn't scale so good).
In summary, shards: "auto" already solved my situation using discord.js main lib, BUT, costing me 2000% more RAM than your library.
Question: I'm doing something wrong or shards auto option (in ClientOptions params) isn't working?
PS: In rare cases it works, but in most part of time not.
Error [SHARDING_REQUIRED]: This session would have handled too many guilds - Sharding is required.
801|vps | at WebSocketManager.createShards (/root/fork-heroku-bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:249:15)
801|vps | at async Client.login (/root/fork-heroku-bot/node_modules/discord.js/src/client/Client.js:245:7)
801|vps | at async upsetEvents (/root/fork-heroku-bot/dist/bot.js:336:21) {
801|vps | [Symbol(code)]: 'SHARDING_REQUIRED'
801|vps | }
const config = {
intents: ["GUILD_MESSAGES"],
makeCache: Discord.Options.cacheWithLimits({
ApplicationCommandManager: 0,
BaseGuildEmojiManager: 0,
ChannelManager: 0,
GuildChannelManager: 0,
GuildBanManager: 0,
GuildInviteManager: 0,
GuildManager: Infinity,
GuildMemberManager: 0,
GuildStickerManager: 0,
MessageManager: 0,
PermissionOverwriteManager: 0,
PresenceManager: 0,
ReactionManager: 0,
ReactionUserManager: 0,
RoleManager: 0,
StageInstanceManager: 0,
ThreadManager: 0,
ThreadMemberManager: 0,
UserManager: 0,
VoiceStateManager: 0
})
}
const Discord = require("discord.js-light")
...
some code here
...
discordApiKey.forEach((_) => this.client.push(new Discord.Client({
...config,
shards: "auto"
})))