kordlib / kord

Idiomatic Kotlin Wrapper for The Discord API
MIT License
929 stars 81 forks source link

Custom Gateway interface / FixedShardGateway class? #445

Open auguwu opened 3 years ago

auguwu commented 3 years ago

At the moment, Kord only implements the MasterGateway: https://github.com/kordlib/kord/blob/0.8.x/core/src/main/kotlin/builder/kord/KordBuilder.kt#L229-L240

But, could there be a option for a DSL block to implement its own way to get the gateway, i.e:

val kord = Kord {
   gateway {
      SomeCustomGateway()
   }
}

In which, SomeCustomGateway inherits from the Gateway interface.

Also, could there be a new Gateway class for a fixed amount of shards, probably named FixedShardGateway? Or a better name if suggested, in which, you can link it to the gateway DSL block. This can probably be linked with the multi-process issue (#7).

If you don't plan to let users create a custom gateway for Kord, that's completely fine and it can be closed if there is any issues with it.

HopeBaron commented 3 years ago

Thanks for opening the issue. Yes, we do plan to change how gateways work in general. So we will have time to look at your request from a better perspective by then.

auguwu commented 3 years ago

Thanks for the comment and can't wait for the gateway rework! 💜