twitch: assume defaults if twitch doesn't tell us a game

This commit is contained in:
Chris Sexton 2023-01-10 21:36:14 -05:00
parent 7eba55f236
commit 0c94d71960
1 changed files with 7 additions and 2 deletions

View File

@ -475,8 +475,13 @@ func (p *Twitch) onlineCB(w http.ResponseWriter, r *http.Request) {
twitcher.online = true
twitcher.URL = twitcher.url()
twitcher.gameID = streams.Data.Streams[0].GameID
twitcher.Game = streams.Data.Streams[0].GameName
if len(streams.Data.Streams) > 0 {
twitcher.gameID = streams.Data.Streams[0].GameID
twitcher.Game = streams.Data.Streams[0].GameName
} else {
twitcher.gameID = "-1"
twitcher.Game = p.c.Get("twitch.unknowngame", "IDK, Twitch didn't tell me")
}
if ch := p.c.Get("twitch.channel", ""); ch != "" {
p.streaming(p.b.DefaultConnector(), ch, twitcher)
if p.c.GetBool("twitch.irc", false) {