Start distance listing

This commit is contained in:
idanoo 2022-09-13 19:39:44 +12:00
parent ee32ba1537
commit 2607b23dcd
Signed by: idanoo
GPG Key ID: 387387CDBC02F132
2 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,12 @@ func (c *LocalConfig) sendEmbeddedMessage(listing TradeMeListing) {
AddField("Location", listing.Address, true).
AddField("Bedrooms", fmt.Sprintf("%d", listing.Bedrooms), true)
// Only add address if token set
if c.GoogleApiToken != "" && c.GoogleLocation1 != "" {
distance := getDistanceFromAddress(listing.Address, c.GoogleLocation1)
embed = embed.AddField(fmt.Sprintf("Distance to %s", c.GoogleLocation1), distance, false)
}
embeds := []discord.Embed{}
embeds = append(embeds, embed.Build())
_, err := c.DiscordClient.CreateEmbeds(embeds)

View File

@ -0,0 +1,6 @@
package flatfinder
// getDistanceFromAddress - Return distance from 2 points
func getDistanceFromAddress(from string, to string) string {
return "N/A"
}