Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import time
- import datetime
- r = praw.Reddit(client_secret='',
- client_id='',
- username='',
- user_agent='',
- password='')
- # Get time
- currentSysTime = time.localtime()
- now = datetime.datetime.now(datetime.timezone.utc).timestamp()
- today = datetime.date.today()
- log_post = (r.submission('93ypq5'))
- subbie = 'ThanosDidNothingWrong' # sub to operate in
- moderators = r.subreddit(subbie).moderator()
- print("Bot for r/{}. Removes dead submissions.".format(subbie))
- print("Checking submissions...")
- def TDNWRemoveBot():
- removal_reason = """Hi /u/{}, thanks for your submission to /r/thanosdidnothingwrong! Unfortunately it has been removed for the following reason(s):
- ---
- **RULE 2:**
- - 2b. All posts 1 day old and below 50 karma will be automatically removed.
- ---
- *If you feel this was removed in error or are unsure about why this was removed then please [modmail us.](https://www.reddit.com/message/compose?to=%2Fr%2Fthanosdidnothingwrong)*
- ^^If ^^you ^^are ^^not ^^able ^^to ^^read ^^the ^^removal ^^reason ^^please ^^use ^^desktop ^^mode.
- """
- removed = []
- for submission in r.subreddit(subbie).new(limit=1000): #get 100 unapproved posts
- if submission.score < 50: # only if they are < 50
- age = now - submission.created_utc
- if age > int(86400): # if it's over 24 hours
- if submission not in removed:
- if submission.author not in moderators:
- submission.mod.remove() # remove submission
- removal_comment = submission.reply(removal_reason.format(submission.author))
- removal_comment.mod.distinguish(how='yes', sticky=True)
- removed.append(submission.permalink)
- print("reddit.com" + submission.permalink)
- print(len(removed))
- removals = '\n\n * '.join(removed)
- r.subreddit(subbie).message('[Notification] Automated Removals - {}'.format(today),
- """
- The following submissions were removed for being low-effort after receiving less than 50 upvotes in twenty-four hours.
- * {}
- Total removals: {}
- """.format(removals, len(removed)))
- TDNWRemoveBot()
Add Comment
Please, Sign In to add comment