gatewayws

package
v0.0.0-...-7f4bee4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdentifyMutexRootName = "/gateway/identify/"
)
View Source
const LogInterval = 10 * time.Minute

Variables

Functions

This section is empty.

Types

type Identify

type Identify struct {
	Token          string         `json:"token"`
	Properties     Props          `json:"properties"`
	Compress       bool           `json:"compress"`
	LargeThreshold int            `json:"large_threshold"`
	Shard          []int          `json:"shard"`
	Intents        int            `json:"intents,omitempty"`
	Presence       updatePresence `json:"presence"`
}

type Intent

type Intent uint
const (
	IntentGuilds Intent = iota
	IntentGuildMembers
	IntentGuildBans
	IntentGuildEmojis
	IntentGuildIntegrations
	IntentGuildWebhooks
	IntentGuildInvites
	IntentGuildVoiceStates
	IntentGuildPresences
	IntentGuildMessages
	IntentGuildMessageReactions
	IntentGuildMessageTyping
	IntentDirectMessages
	IntentDirectMessageReactions
	IntentDirectMessageTyping
	IntentMessageContent
)

type Intents

type Intents []Intent

func (Intents) Collect

func (i Intents) Collect() (n int)

type Op

type Op struct {
	Op int         `json:"op"`
	D  interface{} `json:"d"`
}

type Props

type Props struct {
	Os      string `json:"os"`
	Browser string `json:"browser"`
	Device  string `json:"device"`
}

type RequestGuildMembers

type RequestGuildMembers struct {
	GuildID int64  `json:"guild_id"`
	Query   string `json:"query"`
	Limit   int    `json:"limit"`
}

type Resume

type Resume struct {
	Token     string `json:"token"`
	SessionID string `json:"session_id"`
	Sequence  int64  `json:"seq"`
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession(cfg *SessionConfig) (*Session, error)

func (*Session) Cancel

func (s *Session) Cancel()

func (*Session) GatewayURL

func (s *Session) GatewayURL() string

func (*Session) LongLastAck

func (s *Session) LongLastAck(threshold time.Duration) bool

func (*Session) Open

func (s *Session) Open(ctx context.Context, token string) error

func (*Session) RequestGuildMembers

func (s *Session) RequestGuildMembers(guildID int64)

func (*Session) Status

func (s *Session) Status() string

type SessionConfig

type SessionConfig struct {
	Name              string
	Logger            slog.Logger
	DB                state.DB
	WorkGroup         *sync.WaitGroup
	Redis             *redis.Client
	MultiRedis        []*redis.Client
	Etcd              *clientv3.Client
	Token             string
	Intents           Intents
	ShardID           int
	ShardCount        int
	BufferPool        *sync.Pool
	WhitelistedEvents map[string]struct{}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL