feat(link): Add overview link
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1af7f0a506
commit
d7c8942421
8
api/availability.go
Normal file
8
api/availability.go
Normal file
@ -0,0 +1,8 @@
|
||||
package api
|
||||
|
||||
import "fmt"
|
||||
|
||||
// GetOrderLink give the link to order the car.
|
||||
func (a *Availability) GetOrderLink() string {
|
||||
return fmt.Sprintf("https://www.tesla.com/fr_FR/%s/order/%s?postal=59110®ion=FR&referral=jon833", a.Model, a.Vin)
|
||||
}
|
@ -63,9 +63,10 @@ func handleAlert(bot *tele.Bot, config *botConfig, alertChan chan api.Availabili
|
||||
_, err := bot.Send(
|
||||
tele.ChatID(chatId),
|
||||
fmt.Sprintf(
|
||||
"ALERT\\!\\! Found a Tesla Long Range in *%s* color is: *%d* €",
|
||||
"ALERT\\!\\! Found a Tesla Long Range in *%s* color is: *%d*€ [View](%s)",
|
||||
strings.Join(availability.Paint, " and "),
|
||||
availability.Price,
|
||||
availability.GetOrderLink(),
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
@ -154,9 +155,10 @@ func price(c tele.Context) error {
|
||||
}
|
||||
|
||||
return c.Reply(
|
||||
fmt.Sprintf("The lowest price currently found for a *Tesla Long Range* in *%s* color is: *%d* €",
|
||||
fmt.Sprintf("The lowest price currently found for a *Tesla Long Range* in *%s* color is: *%d*€ [View](%s)",
|
||||
strings.Join(availabilities.Results[0].Paint, " and "),
|
||||
availabilities.Results[0].Price,
|
||||
availabilities.Results[0].GetOrderLink(),
|
||||
),
|
||||
)
|
||||
}
|
||||
@ -174,11 +176,12 @@ func list(c tele.Context) error {
|
||||
availabilitiesStr := fmt.Sprintf("Found *%s* cars\n", availabilities.TotalMatchesFound)
|
||||
for _, availability := range availabilities.Results {
|
||||
availabilitiesStr = fmt.Sprintf(
|
||||
"%sTesla Long Range, color *%s* available in *%s* for *%d*€\n",
|
||||
"%sTesla Long Range, color *%s* available in *%s* for *%d*€ [View](%s)\n",
|
||||
availabilitiesStr,
|
||||
strings.Join(availability.Paint, " and "),
|
||||
strings.ReplaceAll(availability.City, "-", "\\-"),
|
||||
availability.Price,
|
||||
availability.GetOrderLink(),
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user