1- from datetime import datetime as time
1+ from datetime import datetime
22import logging
33import praw
44import prawcore
55import sys
66from login import reddit
77
88
9- file_handler = logging .FileHandler (filename = 'duplicates_{}.log' .format (time .now ().strftime ('%m_%d_%y' )))
9+ file_handler = logging .FileHandler (filename = 'duplicates_{}.log' .format (datetime .now ().strftime ('%m_%d_%y' )))
1010stdout_handler = logging .StreamHandler (sys .stdout )
1111handlers = [file_handler , stdout_handler ]
1212
@@ -27,17 +27,17 @@ def action():
2727 with open ('blockusers.txt' ,'r' ) as newfile :
2828 for line in newfile .readlines ():
2929 line = line .strip ('\n ' )
30- if str (submission .author ) == line :
30+ if str (submission .author ) == line or 'bot' in str ( submission . author ) :
3131 blockeduser = 1
3232 logger .debug ('User {}\' s submission {} was blocked from posting' .format (str (submission .author ),str (sub_id )))
3333 else :
3434 pass
3535 if blockeduser == 0 :
36- for duplicate in submission .duplicates ():
36+ for duplicate in submission .duplicates ():
3737 dup_sub = praw .models .Submission (reddit , id = duplicate )
38- if 'ImagesOf ' not in str (dup_sub .subreddit ) and 'auto' not in str (dup_sub .subreddit ):
38+ if 'imagesof ' not in str (dup_sub .subreddit ). lower () and 'auto' not in str (dup_sub .subreddit ). lower ( ):
3939 time = dup_sub .created
40- time = str (time .fromtimestamp (time ))
40+ time = str (datetime .fromtimestamp (time ))
4141 author = str (dup_sub .author )
4242 if str (submission .author ) == author :
4343 author = author + '[author of both threads]'
0 commit comments