impl sending maps of pickup+dropoff
This commit is contained in:
20
main.go
20
main.go
@@ -269,7 +269,23 @@ func dropBanlistJobs(jobs []broker.Job) ([]broker.Job, error) {
|
||||
|
||||
func sendJob(job broker.Job) error {
|
||||
sender := message.NewMatrix()
|
||||
return sender.Send(job.FormatMultilineText())
|
||||
payload := job.FormatMultilineText()
|
||||
if len(payload) == 0 {
|
||||
return nil
|
||||
}
|
||||
if err := sender.Send(payload); err != nil {
|
||||
return err
|
||||
}
|
||||
maps := config.Get().Maps
|
||||
pickup := fmt.Sprintf("%s, %s", job.Pickup.City, job.Pickup.State)
|
||||
dropoff := fmt.Sprintf("%s, %s", job.Dropoff.City, job.Dropoff.State)
|
||||
if maps.Pickup {
|
||||
sender.SendImage(fmt.Sprintf(maps.URIFormat, pickup, pickup))
|
||||
}
|
||||
if maps.Dropoff {
|
||||
sender.SendImage(fmt.Sprintf(maps.URIFormat, dropoff, dropoff))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func sendNewStates(client string, states []config.State) error {
|
||||
@@ -279,5 +295,5 @@ func sendNewStates(client string, states []config.State) error {
|
||||
|
||||
func sendNewPause(client string, pause time.Time) error {
|
||||
sender := message.NewMatrix()
|
||||
return sender.Send(fmt.Sprintf("%s: not searching for loads until %s", client, pause.Format("2006-01-02")))
|
||||
return sender.Send(fmt.Sprintf("%s: only searching for loads on and after %s", client, pause.Format("2006-01-02")))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user