FoxxMD / context-mod

an event-based, reddit moderation bot built on top of snoowrap and written in typescript
https://contextmod.dev
MIT License
49 stars 11 forks source link

rule to weigh user activity in two subreddits #111

Closed wchristian closed 1 year ago

wchristian commented 1 year ago

This is maybe a feature request or maybe me failing to use the facilities well.

We're dealing with brigading, and would like to use the bot to curtail brigading. Currently the most effective filtering would be if we could set up a rule that triggers on:

if (
    $post_count_our_reddit > 1
    and $post_count_brigader_reddit > 1
    and ( $post_count_our_reddit + $post_count_brigader_reddit ) > $activity_threshold
    and ( $post_count_brigader_reddit / $post_count_our_reddit ) > 0.8
)

Is this possible?

FoxxMD commented 1 year ago

CM can do almost all of this! Here's as close to verbatim using the Recent Activity and History rules:

runs:
    - checks:
          - name: Brigade Check
            kind: comment
            # all rules must trigger to trigger the whole Check
            condition: AND
            rules:
                # triggers if user has ANY activities (submissions/comments) in your subreddit
                - name: hasOurSubHistory
                  kind: recentActivity
                  # number of activities to check from user's history
                  window: 100
                  thresholds:
                      - subreddits: # list of subreddits to count from user's history
                            - "mySubreddit"
                        threshold: "> 0" # number of activities that trigger the rule

                # triggers if user has ANY activities (submissions/comments) in brigading subreddit
                - name: hasBrigadingSubHistory
                  kind: recentActivity
                  window: 100
                  thresholds:
                      - subreddits:
                            - "brigadingSubreddit"
                        threshold: "> 0"

                # triggers if user has $activity_threshold number of activities (submissions/comments) in both subreddit
                - name: activityThreshold
                  kind: recentActivity
                  window: 100
                  thresholds:
                      - subreddits:
                            - "mySubreddit"
                            - "brigadingSubreddit"
                        # $activity_threshold
                        threshold: ">  5"

                # not 1-to-1 with what you want...
                # this will check that, of the last 100 activities in user's history, 80% of them occurred in r/brigadingSubreddit
                - name: ratio
                  kind: history
                  include:
                      - "brigadingSubreddit"
                  criteria:
                      - total: "> 80%"
                        window: 100

            actions:
                - kind: remove
wchristian commented 1 year ago

Thanks for the reply, and yeah, that's mostly what i had in mind but that last part would really drown out the signal with the brigaders we're seeing, because it's many accounts with low and inconsistent activity who post a bunch on brigader reddit, but not overwhelmingly so, and come over to ours to drop 1 or 2 posts.

FoxxMD commented 1 year ago

Understood. I've opened up a new issue for comparing ratios and will look into implementing it! Would be a very useful tool.

wchristian commented 1 year ago

image

Thanks so much. :)

wchristian commented 1 year ago

And i guess since #112 is there, this can be closed. :)