mirror of
https://github.com/idanoo/go-flat-finder
synced 2025-07-01 05:32:17 +00:00
Start distance listing
This commit is contained in:
parent
ee32ba1537
commit
2607b23dcd
2 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||
|
|
6
internal/flatfinder/google.go
Normal file
6
internal/flatfinder/google.go
Normal file
|
@ -0,0 +1,6 @@
|
|||
package flatfinder
|
||||
|
||||
// getDistanceFromAddress - Return distance from 2 points
|
||||
func getDistanceFromAddress(from string, to string) string {
|
||||
return "N/A"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue