Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 0dd5864

Browse files
author
PokestarFan
committed
Updated bugfixes
1 parent 10dec00 commit 0dd5864

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

duplicate.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from datetime import datetime as time
1+
from datetime import datetime
22
import logging
33
import praw
44
import prawcore
55
import sys
66
from 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')))
1010
stdout_handler = logging.StreamHandler(sys.stdout)
1111
handlers = [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

Comments
 (0)