2727
2828#defining the searching and removal
2929def action ():
30- global comment_submissions #making glocal comment submission title list
31- comment_submissions = []
32- submission_titles = []
33- submission_number = 0
34- comment_number = 0
35- current_submission_number = 0
36- current_comment_number = 0
3730 logging .info ('Searching...' )
3831 user = r .user .me ()
3932 for comment in r .redditor (str (user )).comments .new (limit = None ): #scanning all comments by reddit user without limit
4033 logging .debug ('On comment {}' .format (str (comment )))
4134 if comment .score < setvalue : #if statement checking the comment score < 0
4235 comment .delete () #deleteing the comment if < 0
4336 logging .info ('Removed comment {}' .format (str (comment )))
44- comment_submissions .append (comment .submission .title ) #adding the comment's original submission title to the list
45-
46- #defining the outputs
47- def print_results ():
48- logging .info ('Search Complete' )
49- logging .info ('--------------------------------------------------' )
50- #if statement. True if there is 1 or more comments removed.
51- if len (comment_submissions ) > 0 :
52- #logging.infoing true results
53- logging .info ('Removed ' + str (len (comment_submissions )) + ' comment(s).' )
54- logging .info ('Comments were under the following submissions: ' )
55- logging .info (* comment_submissions , sep = '\n ' ) #logging.infoing comment's submission's titles with line breaks
56- logging .info ('--------------------------------------------------' )
57- else :
58- #logging.infoing false results
59- logging .info ('No comments removed.' )
60- logging .info ('--------------------------------------------------' )
61-
62- ###########################
63- # code execution
64- ###########################
65-
66-
67- def main ():
68- action ()
69- print_results ()
7037
71- while True :
72- main ()
38+ action ()
0 commit comments