Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import datetime
- import time
- def main():
- reddit = praw.Reddit(client_id='',
- client_secret='',
- password='',
- username='',
- user_agent='my user agent')
- target_subreddit = reddit.subreddit('7330313')
- current_time=datetime.datetime.now()
- current_time=current_time.replace(second=0,microsecond=0)
- for submission in target_subreddit.stream.submissions():
- submission_checker(submission)
- def submission_checker(submission):
- comment_authors=[]
- print("Thread title: " + submission.title)
- print("Minutes since post: ")
- thread_age = datetime.datetime.now(datetime.timezone.utc).timestamp()-submission.created_utc
- thread_age = thread_age/60
- print(thread_age)
- for top_level_comment in submission.comments:
- comment_authors.append(top_level_comment.author.name)
- print( "OP = " + str(submission.author))
- print("Commenters: " + str(comment_authors) + "\n")
- if submission.author in comment_authors:
- print("OP Commented.\n\n")
- if thread_age > 10:
- if submission.author not in comment_authors:
- print("Thread overdue.\nOP has not commented\n")
- submission.mod.remove()
- print("Thread removed.")
- print("----------------------------------------------------------\n")
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement