diff --git a/internal/flatfinder/discord.go b/internal/flatfinder/discord.go index a1095eb..38d9d8c 100644 --- a/internal/flatfinder/discord.go +++ b/internal/flatfinder/discord.go @@ -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) diff --git a/internal/flatfinder/google.go b/internal/flatfinder/google.go new file mode 100644 index 0000000..67ce5dd --- /dev/null +++ b/internal/flatfinder/google.go @@ -0,0 +1,6 @@ +package flatfinder + +// getDistanceFromAddress - Return distance from 2 points +func getDistanceFromAddress(from string, to string) string { + return "N/A" +}