Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func H ¶
func H[T any](handler func(*T)) func(json.RawMessage)
Types ¶
type BitsEvent ¶ added in v1.0.3
type BitsEvent struct { UserName string `json:"user_name"` ChannelName string `json:"channel_name"` UserID string `json:"user_id"` ChannelID string `json:"channel_id"` Time time.Time `json:"time"` ChatMessage string `json:"chat_message"` BitsUsed int `json:"bits_used"` TotalBitsUsed int `json:"total_bits_used"` IsAnonymous bool `json:"is_anonymous"` Context string `json:"context"` BadgeEntitlement any `json:"badge_entitlement"` }
type Connection ¶
type Connection struct { Logger *slog.Logger OnEvent func(Event) // contains filtered or unexported fields }
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) Handle ¶
func (c *Connection) Handle(typ MessageTopic, handler func(json.RawMessage))
func (*Connection) ProcessEvents ¶
func (c *Connection) ProcessEvents(ctx context.Context) error
type Event ¶
type Event struct { Type string `json:"type"` Error string `json:"error"` Nonce string `json:"nonce"` Data json.RawMessage `json:"data"` }
type Message ¶
type Message struct { Type string `json:"type"` Data json.RawMessage `json:"data"` }
type MessageTopic ¶ added in v1.0.3
type MessageTopic string
const ( TopicRewardRedeemed MessageTopic = "reward-redeemed" TopicBitsEvent MessageTopic = "bits_event" )
type OauthToken ¶
type OauthToken struct { Token string Validation twitch.OAuth2ValidateResponse }
type RewardRedeemed ¶
type RewardRedeemed struct { Timestamp time.Time `json:"timestamp"` Redemption struct { ID string `json:"id"` User struct { ID string `json:"id"` Login string `json:"login"` DisplayName string `json:"display_name"` } `json:"user"` ChannelID string `json:"channel_id"` RedeemedAt time.Time `json:"redeemed_at"` Reward struct { ID string `json:"id"` ChannelID string `json:"channel_id"` Title string `json:"title"` Prompt string `json:"prompt"` Cost int `json:"cost"` IsUserInputRequired bool `json:"is_user_input_required"` IsSubOnly bool `json:"is_sub_only"` Image struct { URL1X string `json:"url_1x"` URL2X string `json:"url_2x"` URL4X string `json:"url_4x"` } `json:"image"` DefaultImage struct { URL1X string `json:"url_1x"` URL2X string `json:"url_2x"` URL4X string `json:"url_4x"` } `json:"default_image"` BackgroundColor string `json:"background_color"` IsEnabled bool `json:"is_enabled"` IsPaused bool `json:"is_paused"` IsInStock bool `json:"is_in_stock"` MaxPerStream struct { IsEnabled bool `json:"is_enabled"` MaxPerStream int `json:"max_per_stream"` } `json:"max_per_stream"` ShouldRedemptionsSkipRequestQueue bool `json:"should_redemptions_skip_request_queue"` } `json:"reward"` UserInput string `json:"user_input"` Status string `json:"status"` } `json:"redemption"` }
Click to show internal directories.
Click to hide internal directories.