Twitch fixes

This commit is contained in:
Asaf Gartner 2022-10-13 19:38:46 +03:00
parent 0f58cfc2da
commit cf809a3cdc
2 changed files with 3 additions and 2 deletions

View File

@ -167,7 +167,7 @@ func PostStreamHistory(ctx context.Context, history *models.TwitchStreamHistory)
} }
duration := history.EndedAt.Sub(history.StartedAt).Truncate(time.Minute).String() duration := history.EndedAt.Sub(history.StartedAt).Truncate(time.Minute).String()
messageContent := fmt.Sprintf( messageContent := fmt.Sprintf(
"**%s** was live: https://twitch.tv/%s\n> _%s_\nAt <t:%d:F> For %s%s", ":o: **%s** was live: https://twitch.tv/%s\n> _%s_\nOn <t:%d:F> for %s%s",
history.TwitchLogin, history.TwitchLogin,
history.TwitchLogin, history.TwitchLogin,
history.Title, history.Title,

View File

@ -774,7 +774,7 @@ func fetchLatestStreamStatus(ctx context.Context, conn db.ConnOrTx, twitchID str
result = &models.TwitchLatestStatus{ result = &models.TwitchLatestStatus{
TwitchID: twitchID, TwitchID: twitchID,
TwitchLogin: twitchLogin, TwitchLogin: twitchLogin,
Tags: []string{}, Tags: make([]string, 0),
} }
} else if err != nil { } else if err != nil {
return nil, oops.New(err, "failed to fetch existing twitch status") return nil, oops.New(err, "failed to fetch existing twitch status")
@ -874,6 +874,7 @@ func updateStreamHistory(ctx context.Context, dbConn db.ConnOrTx, status *models
if err == db.NotFound { if err == db.NotFound {
history = &models.TwitchStreamHistory{} history = &models.TwitchStreamHistory{}
history.Tags = make([]string, 0)
history.StreamID = status.StreamID history.StreamID = status.StreamID
history.TwitchID = status.TwitchID history.TwitchID = status.TwitchID
history.TwitchLogin = status.TwitchLogin history.TwitchLogin = status.TwitchLogin