Not DM notifications about follow in replies

This commit is contained in:
localhost_frssoft 2022-11-24 23:10:33 +03:00
parent 262a480ffe
commit 8f34b1de88
1 changed files with 15 additions and 8 deletions

23
bot.go
View File

@ -146,16 +146,23 @@ func RunBot() {
add_to_db(acct)
InfoLogger.Printf("%s added to database", acct)
}
message := fmt.Sprintf("@%s %s", acct, Conf.NotFollowedMessage)
_, err := postToot(message, "direct")
if err != nil {
ErrorLogger.Printf("Notify %s", acct)
if notif.Status.InReplyToID == nil { // Prevent spam in DM if status is reply
message := fmt.Sprintf("@%s %s", acct, Conf.NotFollowedMessage)
_, err := postToot(message, "direct")
if err != nil {
ErrorLogger.Printf("Notify %s", acct)
}
InfoLogger.Printf("%s has been notified", acct)
mark_notice(acct)
if got_notice(acct) == 0 {
InfoLogger.Printf("Dooble notice marked")
mark_notice(acct)
}
InfoLogger.Printf("%s marked notification in database", acct)
} else {
InfoLogger.Printf("%s their status is reply, not notified", acct)
}
InfoLogger.Printf("%s has been notified", acct)
mark_notice(acct)
InfoLogger.Printf("%s marked notification in database", acct)
}
}
}