Documentation ¶
Index ¶
- func ShardIDByGuild(guildID snowflake.ID, shardCount int) int
- type Config
- type ConfigOpt
- func WithAutoScaling(autoScaling bool) ConfigOpt
- func WithGatewayConfigOpts(opts ...gateway.ConfigOpt) ConfigOpt
- func WithGatewayCreateFunc(gatewayCreateFunc gateway.CreateFunc) ConfigOpt
- func WithLogger(logger log.Logger) ConfigOpt
- func WithRateLimiter(rateLimiter srate.Limiter) ConfigOpt
- func WithRateLimiterConfigOpt(opts ...srate.ConfigOpt) ConfigOpt
- func WithShardCount(shardCount int) ConfigOpt
- func WithShardSplitCount(shardSplitCount int) ConfigOpt
- func WithShards(shards ...int) ConfigOpt
- type ShardManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShardIDByGuild ¶
Types ¶
type Config ¶
type Config struct { Logger log.Logger ShardIDs map[int]struct{} ShardCount int ShardSplitCount int AutoScaling bool GatewayCreateFunc gateway.CreateFunc GatewayConfigOpts []gateway.ConfigOpt RateLimiter srate.Limiter RateLimiterConfigOpts []srate.ConfigOpt }
func DefaultConfig ¶
func DefaultConfig() *Config
type ConfigOpt ¶
type ConfigOpt func(config *Config)
func WithAutoScaling ¶ added in v0.11.0
func WithGatewayConfigOpts ¶
func WithGatewayCreateFunc ¶
func WithGatewayCreateFunc(gatewayCreateFunc gateway.CreateFunc) ConfigOpt
func WithLogger ¶
func WithRateLimiter ¶
func WithShardCount ¶
func WithShardSplitCount ¶ added in v0.11.0
func WithShards ¶
type ShardManager ¶
type ShardManager interface { Logger() log.Logger Open(ctx context.Context) Close(ctx context.Context) OpenShard(ctx context.Context, shardID int) error CloseShard(ctx context.Context, shardID int) ShardByGuildID(guildId snowflake.ID) gateway.Gateway Shard(shardID int) gateway.Gateway Shards() map[int]gateway.Gateway }
func New ¶
func New(token string, eventHandlerFunc gateway.EventHandlerFunc, opts ...ConfigOpt) ShardManager
Click to show internal directories.
Click to hide internal directories.