Add ViewersCount from Twitch to the stream status

This commit is contained in:
Dmitrii Okunev
2024-10-22 15:10:06 +01:00
parent 901a5ce6ca
commit da7744e26e
3 changed files with 12 additions and 5 deletions

View File

@@ -101,6 +101,7 @@ func ConvertStreamProfiles[T StreamProfile](
type StreamStatus struct { type StreamStatus struct {
IsActive bool IsActive bool
ViewersCount *uint `json:",omitempty"`
StartedAt *time.Time `json:",omitempty"` StartedAt *time.Time `json:",omitempty"`
CustomData any `json:",omitempty"` CustomData any `json:",omitempty"`
} }

View File

@@ -450,6 +450,7 @@ func (t *Twitch) GetStreamStatus(
return &streamcontrol.StreamStatus{ return &streamcontrol.StreamStatus{
IsActive: true, IsActive: true,
StartedAt: &stream.StartedAt, StartedAt: &stream.StartedAt,
ViewersCount: ptr(uint(stream.ViewerCount)),
}, nil }, nil
} }

View File

@@ -0,0 +1,5 @@
package twitch
func ptr[T any](in T) *T {
return &in
}