mirror of
https://github.com/aykhans/azal-bot.git
synced 2025-04-20 22:07:16 +00:00
🔨 Handle warnings when no flights are available for a given day
This commit is contained in:
parent
4f4f0f1fa7
commit
db805c0aa4
5
main.go
5
main.go
@ -88,6 +88,7 @@ func (responseTime *ResponseTime) UnmarshalJSON(b []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SuccessResponse struct {
|
type SuccessResponse struct {
|
||||||
|
Warnings []any `json:"warnings"`
|
||||||
Search struct {
|
Search struct {
|
||||||
OptionSets []struct {
|
OptionSets []struct {
|
||||||
Options []struct {
|
Options []struct {
|
||||||
@ -461,6 +462,10 @@ func startBot(botConfig *BotConfig, ifAvailable func(avialableFlights AvialableF
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(data.Warnings) > 0 {
|
||||||
|
log.Println(Colored(Colors.Yellow, "No flights available for ", day))
|
||||||
|
continue
|
||||||
|
}
|
||||||
for _, option := range data.Search.OptionSets[0].Options {
|
for _, option := range data.Search.OptionSets[0].Options {
|
||||||
departureDate := option.Route.DepartureDate
|
departureDate := option.Route.DepartureDate
|
||||||
if (departureDate.After(botConfig.FirstDate) || departureDate.Equal(botConfig.FirstDate)) &&
|
if (departureDate.After(botConfig.FirstDate) || departureDate.Equal(botConfig.FirstDate)) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user