1
- from datetime import datetime as time
1
+ from datetime import datetime
2
2
import logging
3
3
import praw
4
4
import prawcore
5
5
import sys
6
6
from login import reddit
7
7
8
8
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' )))
10
10
stdout_handler = logging .StreamHandler (sys .stdout )
11
11
handlers = [file_handler , stdout_handler ]
12
12
@@ -27,17 +27,17 @@ def action():
27
27
with open ('blockusers.txt' ,'r' ) as newfile :
28
28
for line in newfile .readlines ():
29
29
line = line .strip ('\n ' )
30
- if str (submission .author ) == line :
30
+ if str (submission .author ) == line or 'bot' in str ( submission . author ) :
31
31
blockeduser = 1
32
32
logger .debug ('User {}\' s submission {} was blocked from posting' .format (str (submission .author ),str (sub_id )))
33
33
else :
34
34
pass
35
35
if blockeduser == 0 :
36
- for duplicate in submission .duplicates ():
36
+ for duplicate in submission .duplicates ():
37
37
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 ( ):
39
39
time = dup_sub .created
40
- time = str (time .fromtimestamp (time ))
40
+ time = str (datetime .fromtimestamp (time ))
41
41
author = str (dup_sub .author )
42
42
if str (submission .author ) == author :
43
43
author = author + '[author of both threads]'
0 commit comments