From 547a44a9fb502a308f596e6ffe1a90bd6c4607bc Mon Sep 17 00:00:00 2001 From: Dmitry Ilvokhin Date: Mon, 3 Mar 2025 21:31:10 +0000 Subject: Send message to Telegram --- flatbot.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'flatbot.go') 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") } -- cgit v1.2.3-70-g09d2