Documentation
¶
Index ¶
- Variables
- type Config
- type ConfigOpt
- func WithAutoReconnect(autoReconnect bool) ConfigOpt
- func WithBrowser(browser string) ConfigOpt
- func WithCompress(compress bool) ConfigOpt
- func WithDevice(device string) ConfigOpt
- func WithGatewayIntents(gatewayIntents ...discord.GatewayIntents) ConfigOpt
- func WithLargeThreshold(largeThreshold int) ConfigOpt
- func WithMaxReconnectTries(maxReconnectTries int) ConfigOpt
- func WithOS(os string) ConfigOpt
- func WithPresence(presence discord.UpdatePresenceCommandData) ConfigOpt
- func WithRateLimiter(rateLimiter grate.Limiter) ConfigOpt
- func WithRateLimiterConfig(rateLimiterConfig grate.Config) ConfigOpt
- func WithRateLimiterConfigOpts(opts ...grate.ConfigOpt) ConfigOpt
- func WithSequence(sequence discord.GatewaySequence) ConfigOpt
- func WithSessionID(sessionID string) ConfigOpt
- type EventHandlerFunc
- type Gateway
- type Status
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Logger log.Logger
EventHandlerFunc EventHandlerFunc
LargeThreshold int
GatewayIntents discord.GatewayIntents
Compress bool
SessionID *string
LastSequenceReceived *discord.GatewaySequence
AutoReconnect bool
MaxReconnectTries int
RateLimiter grate.Limiter
RateLimiterConfig *grate.Config
Presence *discord.UpdatePresenceCommandData
OS string
Browser string
Device string
}
type ConfigOpt ¶
type ConfigOpt func(config *Config)
func WithAutoReconnect ¶ added in v0.7.3
func WithBrowser ¶
func WithCompress ¶
func WithDevice ¶
func WithGatewayIntents ¶
func WithGatewayIntents(gatewayIntents ...discord.GatewayIntents) ConfigOpt
func WithLargeThreshold ¶
func WithMaxReconnectTries ¶ added in v0.7.2
func WithPresence ¶
func WithPresence(presence discord.UpdatePresenceCommandData) ConfigOpt
func WithRateLimiter ¶
func WithRateLimiterConfig ¶
func WithSequence ¶ added in v0.7.3
func WithSequence(sequence discord.GatewaySequence) ConfigOpt
func WithSessionID ¶ added in v0.7.3
type EventHandlerFunc ¶
type EventHandlerFunc func(gatewayEventType discord.GatewayEventType, sequenceNumber discord.GatewaySequence, payload io.Reader)
type Gateway ¶
type Gateway interface {
Logger() log.Logger
Config() Config
ShardID() int
ShardCount() int
Open(ctx context.Context) error
ReOpen(ctx context.Context, delay time.Duration) error
Close(ctx context.Context)
CloseWithCode(ctx context.Context, code int, message string)
Status() Status
Send(ctx context.Context, command discord.GatewayCommand) error
Latency() time.Duration
}
Gateway is what is used to connect to discord
type Status ¶
type Status int
Status is the state that the client is currently in
const ( StatusUnconnected Status = iota StatusConnecting StatusWaitingForHello StatusIdentifying StatusResuming StatusWaitingForReady StatusReady StatusDisconnected )
Indicates how far along the client is to connecting
func (Status) IsConnected ¶
IsConnected returns whether the Gateway is connected
Click to show internal directories.
Click to hide internal directories.