Reddit comment callback is not an edit instead of a new comment

This commit is contained in:
Simon
2018-08-08 22:41:25 -04:00
parent 458641654c
commit 89e378ffd9
2 changed files with 15 additions and 4 deletions

View File

@@ -41,17 +41,28 @@ class RedditBot:
while True:
try:
# Double check has_crawled
if not self.has_crawled(reddit_obj.id):
reddit_obj.reply(comment)
reply = reddit_obj.reply(comment)
self.log_crawl(reddit_obj.id)
print("Reply to " + reddit_obj.id)
return reply
break
except Exception as e:
print("Waiting 5 minutes: " + str(e))
time.sleep(300)
continue
def edit(self, reddit_comment, new_message):
while True:
try:
reddit_comment.edit(new_message)
print("Edit comment " + reddit_comment.id)
except Exception as e:
print("Waiting 5 minutes: " + str(e))
time.sleep(300)
continue
@staticmethod
def get_comment(stats: dict, website_id, message: str = ""):
comment = message + " \n" if message else ""