Documentation ¶
Index ¶
- func ShardIDByGuild(guildID snowflake.Snowflake, shardCount int) int
- type Config
- type 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 WithShards(shards ...int) ConfigOpt
- type IntSet
- type ShardManager
- type ShardsMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Logger log.Logger Shards *IntSet ShardCount int 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 WithGatewayConfigOpts ¶
func WithGatewayCreateFunc ¶
func WithGatewayCreateFunc(gatewayCreateFunc gateway.CreateFunc) ConfigOpt
func WithLogger ¶
func WithRateLimiter ¶
func WithShardCount ¶
func WithShards ¶
type ShardManager ¶
type ShardManager interface { Logger() log.Logger RateLimiter() srate.Limiter Open(ctx context.Context) ReOpen(ctx context.Context) Close(ctx context.Context) OpenShard(ctx context.Context, shardID int) error ReOpenShard(ctx context.Context, shardID int) error CloseShard(ctx context.Context, shardID int) GetGuildShard(guildId snowflake.Snowflake) gateway.Gateway Shard(shardID int) gateway.Gateway Shards() *ShardsMap }
func New ¶
func New(token string, eventHandlerFunc gateway.EventHandlerFunc, opts ...ConfigOpt) ShardManager
type ShardsMap ¶
type ShardsMap struct {
// contains filtered or unexported fields
}
func NewShardsMap ¶
func NewShardsMap() *ShardsMap
Source Files ¶
Click to show internal directories.
Click to hide internal directories.