mirror of
https://github.com/idanoo/go-flat-finder.git
synced 2024-11-22 00:11:57 +00:00
Start distance listing
This commit is contained in:
parent
ee32ba1537
commit
2607b23dcd
@ -45,6 +45,12 @@ func (c *LocalConfig) sendEmbeddedMessage(listing TradeMeListing) {
|
|||||||
AddField("Location", listing.Address, true).
|
AddField("Location", listing.Address, true).
|
||||||
AddField("Bedrooms", fmt.Sprintf("%d", listing.Bedrooms), 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 := []discord.Embed{}
|
||||||
embeds = append(embeds, embed.Build())
|
embeds = append(embeds, embed.Build())
|
||||||
_, err := c.DiscordClient.CreateEmbeds(embeds)
|
_, 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…
Reference in New Issue
Block a user