Documentation
¶
Index ¶
- type FrameError
- type Shard
- func (s *Shard) Close() error
- func (s *Shard) CloseWithReconnectIntent() error
- func (s *Shard) Dial(ctx context.Context, URLString string) (connection net.Conn, err error)
- func (s *Shard) EventLoop(ctx context.Context) error
- func (s *Shard) PrepareForReconnect() error
- func (s *Shard) Write(op command.Type, data []byte) error
- type ShardConfig
- type WebsocketError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrameError ¶
func (*FrameError) Error ¶
func (e *FrameError) Error() string
type Shard ¶
type Shard struct {
Conn net.Conn
State *discordgateway.GatewayState
// contains filtered or unexported fields
}
func NewShard ¶
func NewShard(shardID discordgateway.ShardID, botToken string, handler discordgateway.Handler, options ...discordgateway.Option) (*Shard, error)
func (*Shard) CloseWithReconnectIntent ¶
CloseWithReconnectIntent closes the shard connection, but allows the session to be resumed later on.
func (*Shard) Dial ¶
Dial sets up the websocket connection before identifying with the gateway. The url must be complete and specify api version and encoding:
"wss://gateway.discord.gg/" => invalid "wss://gateway.discord.gg/?v=9" => invalid "wss://gateway.discord.gg/?v=9&encoding=json" => valid
func (*Shard) PrepareForReconnect ¶
type ShardConfig ¶
type ShardConfig struct {
BotToken string
ShardID uint
TotalNumberOfShards uint
IdentifyProperties discordgateway.IdentifyConnectionProperties
GuildEvents []event.Type
DMEvents []event.Type
CommandRateLimitChan <-chan int
IdentifyRateLimiter discordgateway.IdentifyRateLimiter
// Intents does not have to be specified as these are derived from GuildEvents
// and DMEvents. However, you can specify intents and it will be merged with the derived intents.
Intents intent.Type
}
type WebsocketError ¶
type WebsocketError struct {
Err error
}
func (*WebsocketError) Error ¶
func (e *WebsocketError) Error() string
func (*WebsocketError) Unwrap ¶
func (e *WebsocketError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.