fjodor-rybakov/discord-nestjs

Add support for discord-hybrid-sharding.

KieronWiltshire opened this issue · 1 comments

Hybrid sharding allows the bot to make use of both traditional and internal sharding for optimal memory usage. This is heavily required at scale. https://github.com/meister03/discord-cross-hosting Is a package that allows scaling shards across multiple hosts however it's only compatible with https://github.com/meister03/discord-hybrid-sharding. The only key difference I was able to spot is how events are registered. If we allowed the ability to specify an implementation for the #getClient function on the client.service.ts. We could add support for this that would allow the use of this package at scale.

If you instead wanted to add direct support for this package, I believe we could just swap this implementation below

getClient(): Client {
return this.client;
}

with:

getClient(): Client {
    return (this.client.cluster || this.client) as Client;
}

Although I believe this could break a few things internally. It would need to be tested.

Irrelevant. Communication issue. Misunderstood the discord-hybrid-sharding package.