Documentation
¶
Index ¶
- type Chat
- type GraphQL
- func (gql *GraphQL) ClaimBonus(streamer *Streamer, claimID string) error
- func (gql *GraphQL) ClaimMoment(momentID string) error
- func (gql *GraphQL) GetFollows() ([]string, error)
- func (gql *GraphQL) GetSteamerID(name string) (string, error)
- func (gql *GraphQL) GetStreamBroadcastID(streamer *Streamer) error
- func (gql *GraphQL) JoinRaid(raidID string) error
- func (gql *GraphQL) LoadChannelPoints(streamer *Streamer) error
- func (gql *GraphQL) MakePrediction(eventID string, outcomeID string, points int) error
- func (gql *GraphQL) PlaybackAccessToken(streamer *Streamer) (string, string, error)
- func (gql *GraphQL) SendRequest(payload GraphQLRequest, ptr any) error
- type GraphQLRequest
- type GraphQLRequestExtensions
- type GraphQLRequestExtensionsPersistedQuery
- type LoginSession
- type Miner
- func (miner *Miner) AddStreamer(username string, user *User) *Streamer
- func (miner *Miner) AddStreamersFromFollows(user *User) error
- func (miner *Miner) AddUser(user *User)
- func (miner *Miner) Alert(data ...any)
- func (miner *Miner) BulkAddStreamers(user *User, streamers []string)
- func (miner *Miner) GetStreamerByID(streamerID string) *Streamer
- func (miner *Miner) GetUsersForStreamer(id string) []*User
- func (miner *Miner) MinePoints(user *User) error
- func (miner *Miner) OnClaimAvailable(message WebsocketMessage)
- func (miner *Miner) OnMessage(message WebsocketMessage)
- func (miner *Miner) OnMoment(message WebsocketMessage)
- func (miner *Miner) OnPointsUpdate(message WebsocketMessage)
- func (miner *Miner) OnPredictionUpdate(message WebsocketMessage)
- func (miner *Miner) OnRaidUpdate(message WebsocketMessage)
- func (miner *Miner) OnStreamDown(message WebsocketMessage)
- func (miner *Miner) OnStreamUp(message WebsocketMessage)
- func (miner *Miner) OnViewcount(message WebsocketMessage)
- func (miner *Miner) Run() error
- func (miner *Miner) SubscribeToTopics()
- func (miner *Miner) UpdateStreamerTopicSubscriptions() error
- func (miner *Miner) UpdateVersions() error
- type MiningStrategy
- type MomentActiveEvent
- type Options
- type PersistentState
- type Prediction
- type PredictionStatus
- type PredictionStrategy
- type RawWebsocketMessage
- type RawWebsocketMessageData
- type Streamer
- type User
- type WebsocketConnection
- type WebsocketMessage
- type WebsocketMessageContent
- type WebsocketPool
- func (pool *WebsocketPool) ListenTopic(topic *WebsocketTopic) error
- func (pool *WebsocketPool) OnDisconnect(conn *WebsocketConnection)
- func (pool *WebsocketPool) RevalidateTopics() error
- func (pool *WebsocketPool) SubmitTopic(topic *WebsocketTopic) error
- func (pool *WebsocketPool) UnlistenTopic(topic *WebsocketTopic) error
- type WebsocketTopic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chat ¶
type Chat struct {
// contains filtered or unexported fields
}
func (*Chat) RevalidateChannelSubscriptions ¶
func (c *Chat) RevalidateChannelSubscriptions()
func (*Chat) RunForever ¶
func (c *Chat) RunForever()
type GraphQL ¶
type GraphQL struct { User *User ClientSession string ClientVersion string DeviceID string Client *http.Client }
func NewGraphQL ¶
func (*GraphQL) ClaimBonus ¶
func (*GraphQL) ClaimMoment ¶
func (*GraphQL) GetFollows ¶
func (*GraphQL) GetStreamBroadcastID ¶
func (*GraphQL) LoadChannelPoints ¶
func (*GraphQL) MakePrediction ¶
func (*GraphQL) PlaybackAccessToken ¶
func (*GraphQL) SendRequest ¶
func (gql *GraphQL) SendRequest(payload GraphQLRequest, ptr any) error
type GraphQLRequest ¶
type GraphQLRequest struct { OperationName string `json:"operationName"` Variables map[string]any `json:"variables"` Extensions GraphQLRequestExtensions `json:"extensions"` }
type GraphQLRequestExtensions ¶
type GraphQLRequestExtensions struct {
PersistedQuery GraphQLRequestExtensionsPersistedQuery `json:"persistedQuery"`
}
type LoginSession ¶
type LoginSession struct {
// contains filtered or unexported fields
}
func (*LoginSession) CheckCode ¶
func (l *LoginSession) CheckCode() (string, error)
func (*LoginSession) GetCode ¶
func (l *LoginSession) GetCode() (string, error)
func (*LoginSession) WaitForToken ¶
func (l *LoginSession) WaitForToken() (string, error)
type Miner ¶
type Miner struct { Options Options WebsocketPool *WebsocketPool DefaultUser *User Users map[string]*User Streamers map[string]*Streamer Predictions map[string]*Prediction Persistent *PersistentState SpadeUrl string Lock sync.Mutex }
func (*Miner) AddStreamersFromFollows ¶
func (*Miner) BulkAddStreamers ¶
func (*Miner) GetStreamerByID ¶
func (*Miner) GetUsersForStreamer ¶
func (*Miner) MinePoints ¶
func (*Miner) OnClaimAvailable ¶
func (miner *Miner) OnClaimAvailable(message WebsocketMessage)
func (*Miner) OnMessage ¶
func (miner *Miner) OnMessage(message WebsocketMessage)
func (*Miner) OnMoment ¶
func (miner *Miner) OnMoment(message WebsocketMessage)
func (*Miner) OnPointsUpdate ¶
func (miner *Miner) OnPointsUpdate(message WebsocketMessage)
func (*Miner) OnPredictionUpdate ¶
func (miner *Miner) OnPredictionUpdate(message WebsocketMessage)
func (*Miner) OnRaidUpdate ¶
func (miner *Miner) OnRaidUpdate(message WebsocketMessage)
func (*Miner) OnStreamDown ¶
func (miner *Miner) OnStreamDown(message WebsocketMessage)
func (*Miner) OnStreamUp ¶
func (miner *Miner) OnStreamUp(message WebsocketMessage)
func (*Miner) OnViewcount ¶
func (miner *Miner) OnViewcount(message WebsocketMessage)
func (*Miner) SubscribeToTopics ¶
func (miner *Miner) SubscribeToTopics()
func (*Miner) UpdateStreamerTopicSubscriptions ¶
func (*Miner) UpdateVersions ¶
type MiningStrategy ¶
type MiningStrategy = string
const ( MiningStrategyLeastPoints MiningStrategy = "LEAST_POINTS" MiningStrategyMostPoints MiningStrategy = "MOST_POINTS" MiningStrategyMostViewers MiningStrategy = "MOST_VIEWERS" )
type MomentActiveEvent ¶
type MomentActiveEvent struct { Data struct { MomentID string `json:"moment_id"` } `json:"data"` }
type Options ¶
type Options struct { MinePoints bool PrioritizeStreaks bool ConcurrentPointLimit int ConcurrentWatchLimit int MiningStrategy MiningStrategy StreamerPriority map[string]int MineRaids bool MineMoments bool MineWatchtime bool WatchTimeOnlyLive bool FollowChatSpam bool MinePredictions bool PredictionsDataPoints int PredictionsMinPoints int PredictionsMaxBet int PredictionsMaxRatio int PredictionsStealth bool PredictionsStrategy PredictionStrategy PersistentFile string DebugWebhook string }
func (Options) RequiresStreamActivity ¶
type PersistentState ¶
type PersistentState struct {
PredictionResults map[string]map[string]int `json:"prediction_results"`
}
func LoadPersistentState ¶
func LoadPersistentState(opt Options) *PersistentState
func (*PersistentState) Save ¶
func (p *PersistentState) Save(opt Options) error
type Prediction ¶
func (*Prediction) DelayedBet ¶
func (p *Prediction) DelayedBet()
func (*Prediction) SmartBet ¶
func (p *Prediction) SmartBet()
type PredictionStatus ¶
type PredictionStatus = string
const ( PredictionStatusActive PredictionStatus = "ACTIVE" PredictionStatusLocked PredictionStatus = "LOCKED" PredictionStatusResolvePending PredictionStatus = "RESOLVE_PENDING" PredictionStatusResolved PredictionStatus = "RESOLVED" )
type PredictionStrategy ¶
type PredictionStrategy = string
const ( PredictionStrategyRandom PredictionStrategy = "RANDOM" PredictionStrategyMostPoints PredictionStrategy = "MOST_POINTS" PredictionStrategyMostIndividuals PredictionStrategy = "MOST_INDIVIDUALS" PredictionStrategyMostIndividualPoints PredictionStrategy = "MOST_INDIVIDUAL_POINTS" PredictionStrategyCautious PredictionStrategy = "CAUTIOUS" )
type RawWebsocketMessage ¶
type RawWebsocketMessage struct { Type string `json:"type"` Data *RawWebsocketMessageData `json:"data"` Error *string `json:"error"` }
type RawWebsocketMessageData ¶
type Streamer ¶
type Streamer struct { Username string ID string Points map[*User]int GotPointsOnce map[*User]bool BroadcastID string Viewers int LastLivePing time.Time WasLive bool LiveTopics []*WebsocketTopic }
func (Streamer) ChannelName ¶
type User ¶
type User struct { Username string ID string AuthToken string Chat *Chat GraphQL *GraphQL Streamers map[string]*Streamer Miner *Miner }
func (*User) ConnectToChat ¶
func (u *User) ConnectToChat()
type WebsocketConnection ¶
type WebsocketConnection struct { ID int // contains filtered or unexported fields }
func NewWebsocketConnection ¶
func NewWebsocketConnection(pool *WebsocketPool) *WebsocketConnection
func (*WebsocketConnection) Connect ¶
func (ws *WebsocketConnection) Connect() error
func (*WebsocketConnection) Disconnect ¶
func (ws *WebsocketConnection) Disconnect()
func (*WebsocketConnection) HandleKeepalive ¶
func (ws *WebsocketConnection) HandleKeepalive()
func (*WebsocketConnection) HandleMessages ¶
func (ws *WebsocketConnection) HandleMessages()
func (*WebsocketConnection) ListenTopics ¶
func (ws *WebsocketConnection) ListenTopics(topics ...*WebsocketTopic) error
type WebsocketMessage ¶
type WebsocketMessage struct { Topics []string Type string Data json.RawMessage }
type WebsocketMessageContent ¶
type WebsocketMessageContent struct {
Type string `json:"type"`
}
type WebsocketPool ¶
type WebsocketPool struct { OnMessage *func(WebsocketMessage) // contains filtered or unexported fields }
func NewWebsocketPool ¶
func NewWebsocketPool() *WebsocketPool
func (*WebsocketPool) ListenTopic ¶
func (pool *WebsocketPool) ListenTopic(topic *WebsocketTopic) error
func (*WebsocketPool) OnDisconnect ¶
func (pool *WebsocketPool) OnDisconnect(conn *WebsocketConnection)
func (*WebsocketPool) RevalidateTopics ¶
func (pool *WebsocketPool) RevalidateTopics() error
func (*WebsocketPool) SubmitTopic ¶
func (pool *WebsocketPool) SubmitTopic(topic *WebsocketTopic) error
func (*WebsocketPool) UnlistenTopic ¶
func (pool *WebsocketPool) UnlistenTopic(topic *WebsocketTopic) error
type WebsocketTopic ¶
type WebsocketTopic struct { Topic string User *User Streamer *Streamer AssignedTo *WebsocketConnection }
func (*WebsocketTopic) GetTopicName ¶
func (topic *WebsocketTopic) GetTopicName() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.