mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-10-07 08:20:51 +08:00
Add ViewersCount from Twitch to the stream status
This commit is contained in:
@@ -100,9 +100,10 @@ func ConvertStreamProfiles[T StreamProfile](
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StreamStatus struct {
|
type StreamStatus struct {
|
||||||
IsActive bool
|
IsActive bool
|
||||||
StartedAt *time.Time `json:",omitempty"`
|
ViewersCount *uint `json:",omitempty"`
|
||||||
CustomData any `json:",omitempty"`
|
StartedAt *time.Time `json:",omitempty"`
|
||||||
|
CustomData any `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChatUserID string
|
type ChatUserID string
|
||||||
|
@@ -448,8 +448,9 @@ func (t *Twitch) GetStreamStatus(
|
|||||||
stream := reply.Data.Streams[0]
|
stream := reply.Data.Streams[0]
|
||||||
|
|
||||||
return &streamcontrol.StreamStatus{
|
return &streamcontrol.StreamStatus{
|
||||||
IsActive: true,
|
IsActive: true,
|
||||||
StartedAt: &stream.StartedAt,
|
StartedAt: &stream.StartedAt,
|
||||||
|
ViewersCount: ptr(uint(stream.ViewerCount)),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
pkg/streamcontrol/twitch/utils.go
Normal file
5
pkg/streamcontrol/twitch/utils.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package twitch
|
||||||
|
|
||||||
|
func ptr[T any](in T) *T {
|
||||||
|
return &in
|
||||||
|
}
|
Reference in New Issue
Block a user