This is a bot for reddit, meant to automate straightforward moderation tasks by automatically performing actions based on defined conditions. For a large description of why this bot was created and what it does, please see this post I made about it on reddit.
If you'd like to utilize this functionality without running your own instance, just add AutoModerator as a mod to any subreddits you'd like to use it in, and send a message to me (Deimorz on reddit) explaining the conditions you'd like set up.
This code has been made public largely for the purpose of displaying exactly what AutoModerator does, and as an example for others working on reddit bots (moderation-related or otherwise). It may be difficult for others to get functional. Use at your own risk.
- mellort / bboe's reddit api wrapper - at least version 1.2.4
- Flask (for future web interface)
- Flask-SQLAlchemy
- BeautifulSoup
Copy modbot.cfg.example to modbot.cfg and edit values to match your desired database and reddit account. You can have SQLAlchemy create the tables for you by importing models.py into a Python interpreter session and calling db.create_all()
.
Add the bot's account as a moderator to any subreddits you want it to check, then add those subreddits to the subreddits
table and the desired conditions to conditions
. (See below for examples of conditions)
I run it using a cronjob that checks through the list of subreddits every 5 minutes, but it would also be possible to run in an infinite loop, so that each subreddit is checked as often as possible.
- subject =
submission
- attribute =
domain
- value =
(bit\.ly|goo\.gl|tinyurl\.com|t\.co|tiny\.cc)
- action =
remove
- subject =
submission
- attribute =
domain
- value =
self\.subredditname
- account_age =
3
- combined_karma =
10
- action =
approve
Condition #1
- subject =
submission
- attribute =
domain
- value =
(reddit\.com|self\.bestof)
- action =
approve
Condition #2
- subject =
submission
- attribute =
domain
- value =
(reddit\.com|self\.bestof)
- inverse =
true
- action =
remove