From fd6aa64d3f4af89c9075e8be359cc9b87487827d Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Sat, 11 May 2024 12:55:05 -0700 Subject: [PATCH] nostr: don't have account age --- automod/rules/example_sets.json | 3 +++ automod/rules/nostr.go | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/automod/rules/example_sets.json b/automod/rules/example_sets.json index 37088852..1d741a38 100644 --- a/automod/rules/example_sets.json +++ b/automod/rules/example_sets.json @@ -14,5 +14,8 @@ ], "promo-domain": [ "buy-crypto.example.com" + ], + "trivial-spam-text": [ + "spam" ] } diff --git a/automod/rules/nostr.go b/automod/rules/nostr.go index 5c33b18e..bcb03799 100644 --- a/automod/rules/nostr.go +++ b/automod/rules/nostr.go @@ -13,13 +13,17 @@ var _ automod.PostRuleFunc = NostrSpamPostRule // looks for new accounts, which frequently post the same type of content func NostrSpamPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error { - if c.Account.Private == nil || c.Account.Identity == nil { + if c.Account.Identity == nil { return nil } - // TODO: helper for account age; and use public info for this (not private) - age := time.Since(c.Account.Private.IndexedAt) - if age > 2*24*time.Hour { - return nil + + // often don't have private metadata for these accounts right after creation + if c.Account.Private != nil { + // TODO: helper for account age; and use public info for this (not private) + age := time.Since(c.Account.Private.IndexedAt) + if age > 2*24*time.Hour { + return nil + } } // is this a bridged nostr account? if not, bail out -- 2.51.2