diff --git a/alert/alert.go b/alert/alert.go index 37eb745..4abc5c6 100644 --- a/alert/alert.go +++ b/alert/alert.go @@ -70,7 +70,7 @@ func checkPrice(alertChan chan api.Availability) { LrAlert := false for _, availability := range availabilities.Results { - if availability.IsDemo { + if availability.IsDemo && availability.Odometer > 100 { continue } diff --git a/bot/bot.go b/bot/bot.go index b0c0cf2..f33a789 100644 --- a/bot/bot.go +++ b/bot/bot.go @@ -60,10 +60,16 @@ func handleAlert(bot *tele.Bot, config *botConfig, alertChan chan api.Availabili for _, chatId := range config.AlertChatIds { log.Infof("Sending alert to chat %d", chatId) + demoStr := "" + if availability.IsDemo { + demoStr = fmt.Sprintf("Demo \\(%d %s\\) ", availability.Odometer, availability.OdometerTypeShort) + } + _, err := bot.Send( tele.ChatID(chatId), fmt.Sprintf( - "ALERT\\!\\! Found a %s in *%s* color is: *%d*€ [View](%s)", + "ALERT\\!\\! Found a %s%s in *%s* color is: *%d*€ [View](%s)", + demoStr, availability.TrimName, strings.Join(availability.Paint, " and "), availability.Price, @@ -210,9 +216,16 @@ func list(c tele.Context) error { availabilitiesStr := fmt.Sprintf("Found *%s* cars\n", availabilities.TotalMatchesFound) for _, availability := range availabilities.Results { + + demoStr := "" + if availability.IsDemo { + demoStr = fmt.Sprintf("Demo \\(%d %s\\) ", availability.Odometer, availability.OdometerTypeShort) + } + availabilitiesStr = fmt.Sprintf( - "%s%s, color *%s* available in *%s* for *%d*€ [View](%s)\n", + "%s%s%s, color *%s* available in *%s* for *%d*€ [View](%s)\n", availabilitiesStr, + demoStr, availability.TrimName, strings.Join(availability.Paint, " and "), strings.ReplaceAll(availability.City, "-", "\\-"),