summaryrefslogtreecommitdiff
path: root/flatbot.go
diff options
context:
space:
mode:
authorDmitry Ilvokhin <d@ilvokhin.com>2025-03-03 21:31:10 +0000
committerDmitry Ilvokhin <d@ilvokhin.com>2025-03-03 21:31:10 +0000
commit547a44a9fb502a308f596e6ffe1a90bd6c4607bc (patch)
treeae20f6fbcf0689569bec5b6ae018a01271abdce1 /flatbot.go
parent96bcc15d6e3e820309c874fe39df11cb88b30af2 (diff)
downloadflatbot-547a44a9fb502a308f596e6ffe1a90bd6c4607bc.tar.gz
flatbot-547a44a9fb502a308f596e6ffe1a90bd6c4607bc.tar.bz2
flatbot-547a44a9fb502a308f596e6ffe1a90bd6c4607bc.zip
Send message to Telegram
Diffstat (limited to 'flatbot.go')
-rw-r--r--flatbot.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/flatbot.go b/flatbot.go
index 3cb052f..fc565f7 100644
--- a/flatbot.go
+++ b/flatbot.go
@@ -5,6 +5,7 @@ import (
"io"
"log"
"net/http"
+ "os"
)
func main() {
@@ -22,6 +23,18 @@ func main() {
log.Fatal(err)
}
flats = removeAlreadySent(flats, sent)
+ m := messenger{
+ Token: os.Getenv("FLATBOT_TELEGRAM_BOT_API_TOKEN"),
+ ChatID: os.Getenv("FLATBOT_TELEGRAM_CHANNEL_ID"),
+ }
+ for _, f := range flats {
+ err = m.Send(f)
+ if err != nil {
+ // TODO: what to do with it?
+ log.Print(err)
+ }
+ sent = append(sent, f)
+ }
fmt.Println(flats)
writeSent(flats, "/tmp/sent.json")
}