Versions in this module Expand all Collapse all v0 v0.16.13 Apr 2, 2020 v0.16.11 Apr 2, 2020 v0.16.9 Apr 2, 2020 v0.16.8 Apr 2, 2020 v0.16.7 Apr 2, 2020 Changes in this version + const DefaultIdentifyRateLimit + const MetricReconnectPeriod + const SaveIncomingPackets + const StatusDND + const StatusIdle + const StatusInvisible + const StatusOffline + const StatusOnline + func CmdNameToOpCode(command string, t ClientType) (op opcode.OpCode) + func ConfigureShardConfig(ctx context.Context, client GatewayBotGetter, conf *ShardConfig) error + func GetShardForGuildID(guildID Snowflake, shardCount uint) (shardID uint) + func NewShardMngr(conf ShardManagerConfig) *shardMngr + func StringToStatusType(status string) (updateStatusPayloadStatus, error) + type ClientType int + type CloseErr struct + func (e *CloseErr) Error() string + type CmdPayload interface + type Conn interface + Close func() error + Disconnected func() bool + Open func(ctx context.Context, endpoint string, requestHeader http.Header) error + Read func(ctx context.Context) (packet []byte, err error) + WriteJSON func(v interface{}) error + type DiscordPacket struct + Data json.RawMessage + EventName string + Op opcode.OpCode + SequenceNumber uint64 + type Event struct + Data []byte + Name string + ShardID uint + type EvtClient struct + ReadyCounter uint + func NewEventClient(shardID uint, conf *EvtConfig) (client *EvtClient, err error) + func (c *EvtClient) Connect() (err error) + func (c *EvtClient) Emit(command string, data CmdPayload) (err error) + func (c *EvtClient) SetPresence(data interface{}) (err error) + func (c EvtClient) AllowedToStartPulsating(serviceID uint8) bool + func (c EvtClient) Disconnect() (err error) + func (c EvtClient) HeartbeatLatency() (duration time.Duration, err error) + func (c EvtClient) IsDisconnected() bool + func (c EvtClient) Receive() <-chan *DiscordPacket + func (c EvtClient) StopPulsating(serviceID uint8) + type EvtConfig struct + BotToken string + Browser string + Device string + DiscordPktPool *sync.Pool + Encoding string + Endpoint string + EventChan chan<- *Event + GuildLargeThreshold uint + GuildSubscriptions bool + HTTPClient *http.Client + IgnoreEvents []string + Logger logger.Logger + MessageQueueLimit uint + Presence *UpdateStatusPayload + ShardCount uint + SystemShutdown chan interface{} + Version int + type Gateway struct + URL string + type GatewayBot struct + SessionStartLimit struct{ ... } + Shards uint + type GatewayBotGetter interface + GetGatewayBot func(context.Context) (gateway *GatewayBot, err error) + type IdentifyMetric struct + Reconnects []time.Time + func (s *IdentifyMetric) ReconnectsSince(d time.Duration) (counter uint) + type Link interface + Connect func() error + Disconnect func() error + type RequestGuildMembersPayload struct + GuildIDs []Snowflake + Limit uint + Query string + UserIDs []Snowflake + type ShardConfig struct + ConnectQueue connectQueue + DisableAutoScaling bool + IdentifiesPer24H uint + OnScalingDiscardedRequests func(unhandledGuildIDs []Snowflake) + OnScalingRequired func(shardIDs []uint) (TotalNrOfShards uint, AdditionalShardIDs []uint) + ShardCount uint + ShardIDs []uint + ShardRateLimit time.Duration + URL string + type ShardManager interface + Connect func() error + Disconnect func() error + Emit func(string, CmdPayload) (unhandledGuildIDs []Snowflake, err error) + GetShard func(shardID shardID) (shard *EvtClient, err error) + HeartbeatLatencies func() (latencies map[shardID]time.Duration, err error) + LocalShardCount func() uint + ShardCount func() uint + ShardIDs func() (shardIDs []uint) + type ShardManagerConfig struct + BotToken string + DefaultBotPresence *UpdateStatusPayload + DisgordInfo string + EventChan chan<- *Event + GuildSubscriptions bool + HTTPClient *http.Client + IgnoreEvents []string + Logger logger.Logger + ProjectName string + RESTClient GatewayBotGetter + ShutdownChan chan interface{} + type Snowflake = util.Snowflake + type UniqueStringSlice struct + func (s *UniqueStringSlice) Add(id string) + func (s *UniqueStringSlice) Contains(id string) (exists bool) + func (s *UniqueStringSlice) Len() int + func (s *UniqueStringSlice) Remove(id string) + type UpdateStatusPayload struct + AFK bool + Game interface{} + Since *uint + Status updateStatusPayloadStatus + type UpdateVoiceStatePayload struct + ChannelID Snowflake + GuildID Snowflake + SelfDeaf bool + SelfMute bool + type VoiceClient struct + SystemShutdown chan interface{} + func NewVoiceClient(conf *VoiceConfig) (client *VoiceClient, err error) + func (c *VoiceClient) Connect() (rdy *VoiceReady, err error) + func (c *VoiceClient) Emit(name string, data interface{}) error + func (c *VoiceClient) SendUDPInfo(data *VoiceSelectProtocolParams) (ret *VoiceSessionDescription, err error) + func (c VoiceClient) AllowedToStartPulsating(serviceID uint8) bool + func (c VoiceClient) Disconnect() (err error) + func (c VoiceClient) HeartbeatLatency() (duration time.Duration, err error) + func (c VoiceClient) IsDisconnected() bool + func (c VoiceClient) Receive() <-chan *DiscordPacket + func (c VoiceClient) StopPulsating(serviceID uint8) + type VoiceConfig struct + Endpoint string + GuildID Snowflake + HTTPClient *http.Client + Logger logger.Logger + MessageQueueLimit uint + SessionID string + SystemShutdown chan interface{} + Token string + UserID Snowflake + type VoiceReady struct + IP string + Modes []string + Port int + SSRC uint32 + type VoiceSelectProtocolParams struct + Address string + Mode string + Port uint16 + type VoiceSessionDescription struct + Mode string + SecretKey [32]byte + type WebsocketErr struct + ID uint + func (e *WebsocketErr) Error() string