diff --git a/discord/webhook.go b/discord/webhook.go index b6515ec..3ee16db 100644 --- a/discord/webhook.go +++ b/discord/webhook.go @@ -40,6 +40,9 @@ func SendWebhook(conf *config.Config, items []client.Items) { colorCode := conf.Color for _, item := range items { tm := time.Unix(item.DiscountExpiration, 0) + if tm.Before(time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC)) { + continue + } embed := GameEmbed{ Title: item.Name, Description: " [-" + strconv.Itoa(item.DiscountPercent) + "%]" + strconv.FormatInt(item.FinalPrice/100, 10) + conf.CurrencySymbol + " ~~" + strconv.FormatInt(item.OriginalPrice/100, 10) + conf.CurrencySymbol + "~~ ", diff --git a/main.go b/main.go index b0e1e5f..ea18417 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,9 @@ var conf *config.Config func (cache Cache) updateAndSend() { responseItems := cache.Client.Get().Specials.Items for _, responseItem := range responseItems { + if responseItem.DiscountExpiration <= 0 { + continue + } _, ok := cache.Items[responseItem.ID] if !ok { cache.Items[responseItem.ID] = responseItem diff --git a/steam/client/client.go b/steam/client/client.go index 71cdaeb..79056fd 100644 --- a/steam/client/client.go +++ b/steam/client/client.go @@ -83,5 +83,9 @@ func (client Client) Get() *Response { func (items Items) IsExpired() bool { now := time.Now().Unix() expirationTime := items.DiscountExpiration + standardTime := time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC) + if items.DiscountExpiration <= 0 || standardTime.After(time.Unix(items.DiscountExpiration, 0)) { + return true + } return now > expirationTime }