More logging and Telegram notifications
This commit is contained in:
parent
8646b97d49
commit
026f0b2074
3
actor.go
3
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
5
http.go
5
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)
|
||||
}
|
||||
|
|
Reference in New Issue