From 026f0b20748170d70ee9ca39b4135076eec069d4 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sat, 25 Apr 2020 10:09:25 +0200 Subject: [PATCH] More logging and Telegram notifications --- actor.go | 3 +++ http.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/actor.go b/actor.go index 3eb05a2..2ca165b 100644 --- a/actor.go +++ b/actor.go @@ -263,5 +263,8 @@ func (a *Actor) Accept(follow map[string]interface{}) { fmt.Println(err.Error()) } else { fmt.Println("Accepted:", follower.iri) + if telegramBot != nil { + _ = telegramBot.Post(follower.iri + " followed") + } } } diff --git a/http.go b/http.go index 687d4a0..728393a 100644 --- a/http.go +++ b/http.go @@ -90,6 +90,9 @@ func Serve() { if iri, ok := object["actor"].(string); ok && iri == activity["actor"] { _ = actor.RemoveFollower(iri) fmt.Println(iri, "unfollowed") + if telegramBot != nil { + _ = telegramBot.Post(iri + " unfollowed") + } } } } @@ -133,6 +136,7 @@ func Serve() { likeActor, likeActorOk := activity["actor"].(string) likeObject, likeObjectOk := activity["object"].(string) if likeActorOk && likeObjectOk && len(likeActor) > 0 && len(likeObject) > 0 && strings.Contains(likeObject, actor.iri) { + fmt.Println(likeActor, "liked", likeObject) if telegramBot != nil { _ = telegramBot.Post(likeActor + " liked " + likeObject) } @@ -143,6 +147,7 @@ func Serve() { announceActor, announceActorOk := activity["actor"].(string) announceObject, announceObjectOk := activity["object"].(string) if announceActorOk && announceObjectOk && len(announceActor) > 0 && len(announceObject) > 0 && strings.Contains(announceObject, actor.iri) { + fmt.Println(announceActor, "announced", announceObject) if telegramBot != nil { _ = telegramBot.Post(announceActor + " announced " + announceObject) }