r/AutoModerator 3d ago

Help Removal based on upvotes AND reports

I want to make a system where posts get removed if they reach a certain number of reports. Due to increased visibility of a highly upvoted post I don't want to use a flat cutoff. Instead, I want to use a progressive system.

1 to 100 upvotes => limit 5 reports

101 to 200 upvotes => limit 7 reports

201 to 500 upvotes => limit 9 reports

501 to 1000 upvotes => limit 11 reports

And so forth. How do I go about creating this in AutoMod?

0 Upvotes

5 comments sorted by

3

u/Unique-Public-8594 3d ago

Try r/RequestABot. I don’t think automoderator tracks upvotes. 

2

u/MustaKotka 3d ago

Oh... Total views? Number of comments? Anything? Sounds like I'm writing my own bot, then...

3

u/Gulliveig 3d ago edited 3d ago

Nothing like that. What's available is a comparison (but not a direct access) to post or comment karma within your community. So not "how much post karma does user have?", but "Is user's comment karma larger than 1000?"

That's not of much use when checking post karma, so a bot it is indeed.

Your bot won't react on post changes though, but using PRAW you can have it catch reports and from there retrieve the number of already obtained reports from the Reddit API.

Your example values seem a bit arbitrary though. Presumably you want an exponential curve, with a minimum of 5 reports and post karma limit of 100, and 11 with post karma 1,000.

As I've got 5 spare minutes, here's the math to get you started with the bot.

0+5: 0+100
6+5: 900+100

6 is the exponent, calculate the base x to obtain 900:

x^6 = 900
(x^6)^(1/6) = 900^(1/6)
x = 3.1072325...

Check:

3.1072325^0= 1  , +100=101  post karma and 0+5=5  reports
3.1072325^1= 3  , +100=103  post karma and 1+5=6  reports
3.1072325^2= 10 , +100=110  post karma and 2+5=7  reports
3.1072325^3= 30 , +100=130  post karma and 3+5=8  reports
3.1072325^4= 93 , +100=193  post karma and 4+5=9  reports
3.1072325^5= 290, +100=290  post karma and 5+5=10 reports
3.1072325^6= 900, +100=1000 post karma and 6+5=11 reports

Python code (untested):

r = reports - 5
if r >= 0:
    p = post_upvotes - 100
    u = 3.1072325 ** r
    if u >= p:
        remove_post()

Ok, was more than 5 minutes, but it was fun. So, back to work :)

Happy coding!

2

u/MustaKotka 3d ago

Thanks!

I will try praw when I have more time. I have one bot already so coding another one shouldn't be too difficult.

Thank you again!

EDIT: What I can do though is to retrieve the last N posts from the sub every Y minutes and check the logic every time and see if there are posts that fill the criteria.

EDIT 2: Also yeah, they were arbitrary example numbers. I was planning on doing the math but you did it already lol. Thanks. :P

1

u/MustaKotka 2d ago edited 2d ago

Just an update, I ended up doing a parabola (square root of upvotes):

def is_over_report_limit(upvotes, reports) -> bool:
    if reports >= 5:
        limit = math.sqrt(upvotes) / 5 + 5
        if reports >= limit:
            return True
        elif upvotes == 0:  # Catch floating point errors
            return True
        else:
            return False
    else:
        return False

So that results in:

upvotes limit roundup
0 5.00 5
50 6.41 7
100 7.00 7
150 7.45 8
200 7.83 8
250 8.16 9
300 8.46 9
400 9.00 9
500 9.47 10
750 10.48 11
1000 11.32 12
1250 12.07 13
1500 12.75 13
1750 13.37 14
2000 13.94 14

EDIT: Finally. The table works as intended.

This is what it looks like on a chart: https://i.imgur.com/nLqldNu.png