27
27
28
28
#defining the searching and removal
29
29
def 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
37
30
logging .info ('Searching...' )
38
31
user = r .user .me ()
39
32
for comment in r .redditor (str (user )).comments .new (limit = None ): #scanning all comments by reddit user without limit
40
33
logging .debug ('On comment {}' .format (str (comment )))
41
34
if comment .score < setvalue : #if statement checking the comment score < 0
42
35
comment .delete () #deleteing the comment if < 0
43
36
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 ()
70
37
71
- while True :
72
- main ()
38
+ action ()
0 commit comments