1+ #Bot to remove any submissions by the user that have negative scores
2+ #Created for /u/Pokestarfan
3+ #Created by reddit /u/dustonwithano
4+ #Please PM me on reddit with any issues
5+
6+ ###########################
7+ # import modules
8+ ###########################
9+
10+ import time
11+ import praw
12+ from login import reddit as r
13+
14+ ###########################
15+ # definitions
16+ ###########################
17+
18+ #defining the log in process
19+ global r
20+
21+ #definig the value: CREATED BY POKESTARFAN AFTER RECIVIAL
22+ setvalue = 1
23+
24+ #defining the searching and removal
25+ def action ():
26+ global submission_titles #making global submission title list
27+ global comment_submissions #making glocal comment submission title list
28+ comment_submissions = []
29+ submission_titles = []
30+ submission_number = 0
31+ comment_number = 0
32+ current_submission_number = 0
33+ current_comment_number = 0
34+ print ('Searching...' )
35+ user = r .user .me ()
36+ for submission in r .redditor (str (user )).submissions .new (limit = None ): #scanning all submissions by reddit user without limit
37+ if submission .score < setvalue : #if statement checking the submission score < 0
38+ submission .delete () #deleting the submission
39+ submission_titles .append (submission .title ) #adding the submission title to the list
40+ for comment in r .redditor (str (user )).comments .new (limit = None ): #scanning all comments by reddit user without limit
41+ if comment .score < setvalue : #if statement checking the comment score < 0
42+ comment .delete () #deleteing the comment if < 0
43+ comment_submissions .append (comment .submission .title ) #adding the comment's original submission title to the list
44+
45+ #defining the outputs
46+ def print_results ():
47+ print ('Search Complete' )
48+ print ('--------------------------------------------------' )
49+ #if statement. True if there is 1 or more submissions removed.
50+ if len (submission_titles ) > 0 :
51+ #printing true results
52+ print ('Removed ' + str (len (submission_titles )) + ' submission(s).' )
53+ print ('Submission title(s) include: ' )
54+ print (* submission_titles , sep = '\n ' ) #printing submission titles with line breaks
55+ print ('--------------------------------------------------' )
56+ else :
57+ #printing false results
58+ print ('No submissions removed.' )
59+ print ('--------------------------------------------------' )
60+ #if statement. True if there is 1 or more comments removed.
61+ if len (comment_submissions ) > 0 :
62+ #printing true results
63+ print ('Removed ' + str (len (comment_submissions )) + ' comment(s).' )
64+ print ('Comments were under the following submissions: ' )
65+ print (* comment_submissions , sep = '\n ' ) #printing comment's submission's titles with line breaks
66+ print ('--------------------------------------------------' )
67+ else :
68+ #printing false results
69+ print ('No comments removed.' )
70+ print ('--------------------------------------------------' )
71+
72+ ###########################
73+ # code execution
74+ ###########################
75+
76+
77+ def main ():
78+ action ()
79+ print_results ()
80+
81+ while True :
82+ main ()
83+ time .sleep (600 )
0 commit comments