fix subscription check
This commit is contained in:
parent
d3f51c73b5
commit
4a63f5e45d
1 changed files with 16 additions and 7 deletions
23
main.go
23
main.go
|
@ -106,6 +106,19 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var subscribers []*mastodon.Account
|
||||
var pg mastodon.Pagination
|
||||
for {
|
||||
fs, err := masto_client.GetAccountFollowers(context.Background(), masto_user.ID, &pg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
subscribers = append(subscribers, fs...)
|
||||
if pg.MaxID == "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// log.Println(my_account)
|
||||
|
||||
matrix_client, err := mautrix.NewClient(os.Getenv("MATRIX_HOMESERVER"), m_id.UserID(os.Getenv("MATRIX_USERNAME")), os.Getenv("MATRIX_ACCESS_TOKEN"))
|
||||
|
@ -225,6 +238,8 @@ notif_loop:
|
|||
}
|
||||
}
|
||||
|
||||
subscribers = append(subscribers, ¬if.Account)
|
||||
|
||||
masto_client.PostStatus(ctx, &mastodon.Toot{
|
||||
Status: fmt.Sprintf("Вітаємо у нашій спільноті! @%s", notif.Account.Acct),
|
||||
Visibility: mastodon.VisibilityUnlisted,
|
||||
|
@ -236,13 +251,7 @@ notif_loop:
|
|||
}
|
||||
|
||||
if notif.Type == "mention" && notif.Status.InReplyToID == nil && notif.Status.InReplyToAccountID == nil {
|
||||
log.Debugf(`post passed reply check (%v)
|
||||
raw data: %v`, notif.Status.ID, notif.Status)
|
||||
subscribers, err := masto_client.GetAccountFollowers(ctx, masto_user.ID, &mastodon.Pagination{Limit: 10000})
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
continue
|
||||
}
|
||||
log.Debugf(`post passed reply check (%v)`, notif.Status.ID)
|
||||
|
||||
ok := false
|
||||
|
||||
|
|
Loading…
Reference in a new issue