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

Commit 9311faf

Browse files
author
PokestarFan
committed
More changes
1 parent 5844377 commit 9311faf

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

Diff for: delete.py

+19-8
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@
22
from modules.logger import setup_logger
33
from modules.login import reddit
44
import logging
5+
import time
56

67
logger = setup_logger('user_removed_comments')
78

8-
for item in reddit.inbox.stream():
9-
logger.debug('On item {}'.format(str(item)))
9+
10+
def main():
1011
try:
11-
if item.body.lower() == 'delete':
12-
item.parent.delete()
13-
logging.info('Comment {} removed'.format(str(item.parent)))
14-
item.reply('The top level post has been removed.')
12+
for item in reddit.inbox.comment_replies(limit=30):
13+
logger.debug('On item {}'.format(str(item)))
14+
print(item.body)
15+
try:
16+
if 'delete' in item.body.lower():
17+
item.parent.delete()
18+
logging.info('Comment {} removed'.format(str(item.parent)))
19+
item.reply('The top level post has been removed.')
20+
except:
21+
logging.debug('Item {} skipped'.format(str(item)))
1522
except:
16-
logging.debug('Item {} skipped'.format(str(item)))
17-
pass
23+
logging.debug('Error!', exc_info=True)
24+
main()
25+
26+
while True:
27+
main()
28+
time.sleep(30)

Diff for: duplicate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def action():
3636
message = 'Here is a list of threads in other subreddits about the same content:\n'
3737
for dup in duplicates:
3838
message = str(message + '\n * [{}]({}) on /r/{} with {} karma (created at {} by {})').format(dup['title'], dup['link'], dup['subreddit'], dup['karma'],dup['time'], dup['author'])
39-
message = message + '\n\n ---- \n\n ^^I ^^am ^^a ^^bot ^^[FAQ](https://www.reddit.com/r/DuplicatesBot/wiki/index)-[Code](https://github.com/PokestarFan/DuplicateBot)-[Bugs](https://www.reddit.com/r/DuplicatesBot/comments/6ypgmx/bugs_and_problems/)-[Suggestions](https://www.reddit.com/r/DuplicatesBot/comments/6ypg85/suggestion_for_duplicatesbot/)-[Block](https://www.reddit.com/r/DuplicatesBot/wiki/index#wiki_block_bot_from_tagging_on_your_posts)'
39+
message = message + '\n\n ---- \n\n ^^I ^^am ^^a ^^bot ^^[FAQ](https://www.reddit.com/r/DuplicatesBot/wiki/index)-[Code](https://github.com/PokestarFan/DuplicateBot)-[Bugs](https://www.reddit.com/r/DuplicatesBot/comments/6ypgmx/bugs_and_problems/)-[Suggestions](https://www.reddit.com/r/DuplicatesBot/comments/6ypg85/suggestion_for_duplicatesbot/)-[Block](https://www.reddit.com/r/DuplicatesBot/wiki/index#wiki_block_bot_from_tagging_on_your_posts)\n\n^^Now ^^you ^^can ^^remove ^^the ^^comment ^^by ^^replying ^^delete!'
4040
try:
4141
submission.reply(message)
4242
logger.info('Message posted on {}'.format(sub_id))

Diff for: run.bat

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
@echo off
2-
py duplicate.py
3-
run.bat
2+
start py duplicate.py
3+
start py delete.py
4+
start py lowpostremover.py

0 commit comments

Comments
 (0)