rules

package
v0.0.0-...-c1b16d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Overview

Example automod rules and helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountDemoPostRule

func AccountDemoPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

this is a dummy rule to demonstrate accessing account metadata (eg, profile) from within post handler

func AccountPrivateDemoPostRule

func AccountPrivateDemoPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

dummy rule. this leaks PII (account email) in logs and should never be used in real life

func AggressivePromotionRule

func AggressivePromotionRule(c *automod.RecordContext, post *appbsky.FeedPost) error

looks for new accounts, with a commercial or donation link in profile, which directly reply to several accounts

this rule depends on ReplyCountPostRule() to set counts

func BadHashtagsPostRule

func BadHashtagsPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

looks for specific hashtags from known lists

func BadWordDIDRule

func BadWordDIDRule(c *automod.AccountContext) error

func BadWordHandleRule

func BadWordHandleRule(c *automod.AccountContext) error

func BadWordOtherRecordRule

func BadWordOtherRecordRule(c *automod.RecordContext) error

scans for bad keywords in records other than posts and profiles

func BadWordPostRule

func BadWordPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

func BadWordProfileRule

func BadWordProfileRule(c *automod.RecordContext, profile *appbsky.ActorProfile) error

func BadWordRecordKeyRule

func BadWordRecordKeyRule(c *automod.RecordContext) error

scans the record-key for all records

func BlobVerifyRule

func BlobVerifyRule(c *automod.RecordContext, blob lexutil.LexBlob, data []byte) error

func BotLinkProfileRule

func BotLinkProfileRule(c *automod.RecordContext, profile *appbsky.ActorProfile) error

func CelebSpamIdentityRule

func CelebSpamIdentityRule(c *automod.AccountContext) error

func CelebSpamProfileRule

func CelebSpamProfileRule(c *automod.RecordContext, profile *appbsky.ActorProfile) error

func DefaultRules

func DefaultRules() automod.RuleSet

func DeleteInteractionRule

func DeleteInteractionRule(c *automod.RecordContext) error

func DistinctMentionsRule

func DistinctMentionsRule(c *automod.RecordContext, post *appbsky.FeedPost) error

DistinctMentionsRule looks for accounts which mention an unusually large number of distinct accounts per period.

func ExtractBlobCIDsProfile

func ExtractBlobCIDsProfile(profile *appbsky.ActorProfile) []string

func ExtractHashtagsPost

func ExtractHashtagsPost(post *appbsky.FeedPost) []string

func ExtractPostBlobCIDsPost

func ExtractPostBlobCIDsPost(post *appbsky.FeedPost) []string

func ExtractTextTokensPost

func ExtractTextTokensPost(post *appbsky.FeedPost) []string

func ExtractTextTokensProfile

func ExtractTextTokensProfile(profile *appbsky.ActorProfile) []string

func ExtractTextURLs

func ExtractTextURLs(raw string) []string

func ExtractTextURLsProfile

func ExtractTextURLsProfile(profile *appbsky.ActorProfile) []string

func GtubePostRule

func GtubePostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

func GtubeProfileRule

func GtubeProfileRule(c *automod.RecordContext, profile *appbsky.ActorProfile) error

func HarassmentTargetInteractionPostRule

func HarassmentTargetInteractionPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

looks for new accounts, which interact with frequently-harassed accounts, and report them for review

func HarassmentTrivialPostRule

func HarassmentTrivialPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

looks for new accounts, which frequently post the same type of content

func HashOfString

func HashOfString(s string) string

returns a fast, compact hash of a string

current implementation uses murmur3, default seed, and hex encoding

func IdenticalReplyPostRule

func IdenticalReplyPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

Looks for accounts posting the exact same text multiple times. Does not currently count the number of distinct accounts replied to, just counts replies at all.

There can be legitimate situations that trigger this rule, so in most situations should be a "report" not "label" action.

func InteractionChurnRule

func InteractionChurnRule(c *automod.RecordContext) error

looks for accounts which do frequent interaction churn, such as follow-unfollow.

func IsSelfThread

func IsSelfThread(c *automod.RecordContext, post *appbsky.FeedPost) bool

checks if the post event is a reply post for which the author is replying to themselves, or author is the root author (OP)

func MisleadingLinkUnicodeReversalPostRule

func MisleadingLinkUnicodeReversalPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

func MisleadingMentionPostRule

func MisleadingMentionPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

func MisleadingURLPostRule

func MisleadingURLPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

func NewAccountBotEmailRule

func NewAccountBotEmailRule(c *automod.AccountContext) error

func NewAccountRule

func NewAccountRule(c *automod.AccountContext) error

triggers on first identity event for an account (DID)

func NormalizeHashtag

func NormalizeHashtag(raw string) string

func NostrSpamPostRule

func NostrSpamPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

looks for new accounts, which frequently post the same type of content

func ParentOrRootIsFollower

func ParentOrRootIsFollower(c *automod.RecordContext, post *appbsky.FeedPost) bool

func ReplyCountPostRule

func ReplyCountPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

does not count "self-replies" (direct to self, or in own post thread)

func ReplySingleBadWordPostRule

func ReplySingleBadWordPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

looks for the specific harassment situation of a replay to another user with only a single word

func SimpleBotPostRule

func SimpleBotPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

func TooManyHashtagsPostRule

func TooManyHashtagsPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error

if a post is "almost all" hashtags, it might be a form of search spam

func YoungAccountDistinctMentionsRule

func YoungAccountDistinctMentionsRule(c *automod.RecordContext, post *appbsky.FeedPost) error

func YoungAccountDistinctRepliesRule

func YoungAccountDistinctRepliesRule(c *automod.RecordContext, post *appbsky.FeedPost) error

Types

type PostFacet

type PostFacet struct {
	Text string
	URL  *string
	DID  *string
	Tag  *string
}

func ExtractFacets

func ExtractFacets(post *appbsky.FeedPost) ([]PostFacet, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL