mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix(bot): keep an explicit lastShardId of 0 in bot.start() (#5382)
bot.start() derived lastShardId from the recommended shard count whenever `!options.gateway?.lastShardId` held, so an explicit `lastShardId: 0` — a valid single shard configuration — was treated as absent and overwritten, spawning every recommended shard in a process meant to run one. Compare against undefined instead. Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Fleny <Fleny113@outlook.com>
This commit is contained in:
co-authored by
Claude Opus 5
Fleny
parent
62a4478de8
commit
93786b6740
@@ -80,7 +80,9 @@ export function createBot<
|
||||
|
||||
if (!options.gateway?.totalShards) bot.gateway.totalShards = bot.gateway.connection.shards;
|
||||
|
||||
if (!options.gateway?.lastShardId && !options.gateway?.totalShards) bot.gateway.lastShardId = bot.gateway.connection.shards - 1;
|
||||
// `lastShardId: 0` is a valid single shard configuration, so an explicit id may not be treated as an absent one.
|
||||
if (options.gateway?.lastShardId === undefined && options.gateway?.totalShards === undefined)
|
||||
bot.gateway.lastShardId = bot.gateway.connection.shards - 1;
|
||||
}
|
||||
|
||||
if (!bot.gateway.resharding.getSessionInfo) {
|
||||
|
||||
Reference in New Issue
Block a user