Documentation
¶
Index ¶
- Constants
- type CloseHandlerFunc
- 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 WithDialer(dialer *websocket.Dialer) 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 ¶
View Source
const Version = 10
Version defines which discord API version disgo should use to connect to discord.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseHandlerFunc ¶ added in v0.11.0
type Config ¶
type Config struct { Logger log.Logger Dialer *websocket.Dialer 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 WithDialer ¶ added in v0.10.0
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, closeHandlerFUnc CloseHandlerFunc, opts ...ConfigOpt) Gateway
type EventHandlerFunc ¶
type Gateway ¶
type Gateway interface { Logger() log.Logger ShardID() int ShardCount() int SessionID() *string LastSequenceReceived() *int GatewayIntents() discord.GatewayIntents Open(ctx context.Context) 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
func New ¶
func New(token string, eventHandlerFunc EventHandlerFunc, closeHandlerFunc CloseHandlerFunc, opts ...ConfigOpt) Gateway
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.