Documentation
¶
Index ¶
- 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 WithGatewayURL(gatewayURL string) ConfigOpt
- func WithLargeThreshold(largeThreshold int) ConfigOpt
- func WithLogger(logger log.Logger) ConfigOpt
- func WithMaxReconnectTries(maxReconnectTries int) ConfigOpt
- func WithOS(os string) ConfigOpt
- func WithPresence(presence discord.GatewayMessageDataPresenceUpdate) ConfigOpt
- func WithRateLimiter(rateLimiter grate.Limiter) ConfigOpt
- func WithRateLimiterConfigOpts(opts ...grate.ConfigOpt) ConfigOpt
- func WithSequence(sequence int) ConfigOpt
- func WithSessionID(sessionID string) ConfigOpt
- func WithShardCount(shardCount int) ConfigOpt
- func WithShardID(shardID int) ConfigOpt
- type CreateFunc
- type EventHandlerFunc
- type Gateway
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Logger log.Logger LargeThreshold int GatewayIntents discord.GatewayIntents Compress bool GatewayURL string ShardID int ShardCount int SessionID *string LastSequenceReceived *int AutoReconnect bool MaxReconnectTries int RateLimiter grate.Limiter RateLimiterConfigOpts []grate.ConfigOpt Presence *discord.GatewayMessageDataPresenceUpdate OS string Browser string Device string }
func DefaultConfig ¶
func DefaultConfig() *Config
type ConfigOpt ¶
type ConfigOpt func(config *Config)
func WithAutoReconnect ¶
func WithBrowser ¶
func WithCompress ¶
func WithDevice ¶
func WithGatewayIntents ¶
func WithGatewayIntents(gatewayIntents ...discord.GatewayIntents) ConfigOpt
func WithGatewayURL ¶
func WithLargeThreshold ¶
func WithLogger ¶
func WithMaxReconnectTries ¶
func WithPresence ¶
func WithPresence(presence discord.GatewayMessageDataPresenceUpdate) ConfigOpt
func WithRateLimiter ¶
func WithSequence ¶
func WithSessionID ¶
func WithShardCount ¶
func WithShardID ¶
type CreateFunc ¶
type CreateFunc func(token string, eventHandlerFunc EventHandlerFunc, opts ...ConfigOpt) Gateway
type EventHandlerFunc ¶
type EventHandlerFunc func(gatewayEventType discord.GatewayEventType, sequenceNumber int, payload io.Reader)
type Gateway ¶
type Gateway interface { Logger() log.Logger ShardID() int ShardCount() int GatewayIntents() discord.GatewayIntents 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, op discord.GatewayOpcode, data discord.GatewayMessageData) 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.