A collection of Osprey rules for ATProto

Compare changes

Choose any two refs to compare.

Changed files
+101 -26
config
models
rules
+4
config/labels.yaml
··· 59 59 valid_for: [UserId] 60 60 connotation: neutral 61 61 description: Account which is engaging in coordinated abuse. 62 + general-spam: 63 + valid_for: [UserId] 64 + connotation: neutral 65 + description: Account which is partaking in general spam.
+6
models/base.sml
··· 24 24 coerce_type=True, 25 25 ) 26 26 27 + Description: str = JsonData( 28 + path='$.eventMetadata.profile.description', 29 + required=False, 30 + coerce_type=True, 31 + ) 32 + 27 33 FollowersCount: int = JsonData( 28 34 path='$.eventMetadata.profile.followersCount', 29 35 required=False,
+1 -1
rules/record/block/blocked_a_lot.sml
··· 45 45 entity=BlockSubjectDid, 46 46 comment='Account was blocked 100 ore more times in 24 hours', 47 47 label='mass-blocks', 48 - expiration_in_hours=7*24, 48 + expiration_in_hours=3*24, 49 49 ), 50 50 ], 51 51 )
-25
rules/record/post/negative_posting.sml
··· 33 33 when_all=[NegativeSentimentCount >= 10, _NegativeSentimentCountHour >= 4], 34 34 description='User has made five or more negative posts in a four hour window', 35 35 ) 36 - 37 - WhenRules( 38 - rules_any=[NegativePostRule], 39 - then=[ 40 - AtprotoLabel( 41 - entity=AtUri, 42 - label='negative-post', 43 - comment='This post is negative', 44 - expiration_in_hours=None, 45 - cid=Cid, 46 - ), 47 - ], 48 - ) 49 - 50 - WhenRules( 51 - rules_any=[NegativePostingRule], 52 - then=[ 53 - AtprotoLabel( 54 - entity=UserId, 55 - label='negative-poster', 56 - comment='This user made five or more negative posts in four hours', 57 - expiration_in_hours=2 * Day, 58 - ), 59 - ], 60 - )
+2
rules/record/post/nsfw_tags.sml
··· 25 25 then=[ 26 26 AtprotoLabel( 27 27 entity=AtUri, 28 + cid=Cid, 28 29 label='likely-nsfw', 29 30 comment=f'Post contains one or many NSFW hashtags: {_FoundTagUnwrapped}', 31 + expiration_in_hours=None, 30 32 ), 31 33 ], 32 34 )
+6
rules/record/profile/index.sml
··· 12 12 Require( 13 13 rule='rules/record/profile/bsky_store.sml', 14 14 ) 15 + Require( 16 + rule='rules/record/profile/julie.sml', 17 + ) 18 + Require( 19 + rule='rules/record/profile/suzune.sml', 20 + )
+42
rules/record/profile/julie.sml
··· 1 + Import( 2 + rules=[ 3 + 'models/base.sml', 4 + 'models/record/base.sml', 5 + 'models/record/profile.sml', 6 + ], 7 + ) 8 + 9 + JulieProfileRule = Rule( 10 + when_all=[ 11 + (StringContains(s=ProfileDescription, substrings=True, phrase='girly.bio') 12 + or StringContains(s=ProfileDescription, substrings=True, phrase='onlyfans') 13 + or StringContains(s=ProfileDescription, substrings=True, phrase='juliewaifu') 14 + or StringContains(s=ProfileDescription, substrings=True, phrase='waifujulie')), 15 + (StringContains(s=ProfileDisplayName, substrings=True, phrase='julie') or 16 + StringContains(s=Handle, substrings=True, phrase='julie')), 17 + AccountAgeSecondsUnwrapped <= Day, 18 + ], 19 + description='Julie profile' 20 + ) 21 + 22 + WhenRules( 23 + rules_any=[JulieProfileRule], 24 + then=[ 25 + AtprotoLabel( 26 + entity=UserId, 27 + label='general-spam', 28 + comment='Julie spam profile', 29 + expiration_in_hours=None, 30 + ), 31 + ], 32 + ) 33 + 34 + WhenRules( 35 + rules_any=[JulieProfileRule], 36 + then=[ 37 + AtprotoList( 38 + did=UserId, 39 + list_uri='at://did:plc:saslbwamakedc4h6c5bmshvz/app.bsky.graph.list/3mbgnj3f2id2l', 40 + ), 41 + ], 42 + )
+40
rules/record/profile/suzune.sml
··· 1 + Import( 2 + rules=[ 3 + 'models/base.sml', 4 + 'models/record/base.sml', 5 + 'models/record/profile.sml', 6 + ], 7 + ) 8 + 9 + SuzuneProfileRule = Rule( 10 + when_all=[ 11 + StringContains(s=ProfileDescription, substrings=True, phrase='onlyfans'), 12 + (StringContains(s=ProfileDisplayName, substrings=True, phrase='suzune') or 13 + StringContains(s=Handle, substrings=True, phrase='suzune') or 14 + StringContains(s=ProfileDescription, substrings=True, phrase='suzune')), 15 + AccountAgeSecondsUnwrapped <= Day, 16 + ], 17 + description='Suzune profile' 18 + ) 19 + 20 + WhenRules( 21 + rules_any=[SuzuneProfileRule], 22 + then=[ 23 + AtprotoLabel( 24 + entity=UserId, 25 + label='general-spam', 26 + comment='Suzune spam profile', 27 + expiration_in_hours=None, 28 + ), 29 + ], 30 + ) 31 + 32 + WhenRules( 33 + rules_any=[SuzuneProfileRule], 34 + then=[ 35 + AtprotoList( 36 + did=UserId, 37 + list_uri='at://did:plc:saslbwamakedc4h6c5bmshvz/app.bsky.graph.list/3mbgnj3f2id2l', 38 + ), 39 + ], 40 + )