Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions commentCleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def delete_old_comments(reddit, username, days_old, comments_deleted):
created_at = datetime.utcfromtimestamp(comment.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
with open('deleted_comments.txt', 'a', encoding='utf-8') as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.subreddit} | {comment.body}\n")
try:
comment.edit(".")
comment.delete()
Expand All @@ -131,7 +131,7 @@ def remove_comments_with_negative_karma(reddit, username, comments_deleted):
created_at = datetime.utcfromtimestamp(comment.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
with open('deleted_comments.txt', 'a', encoding='utf-8') as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.subreddit} | {comment.body}\n")
try:
comment.edit(".")
comment.delete()
Expand Down Expand Up @@ -164,7 +164,7 @@ def remove_comments_with_one_karma_and_no_replies(reddit, username, comments_del
created_at = datetime.utcfromtimestamp(comment.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
with open('deleted_comments.txt', 'a', encoding='utf-8') as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.subreddit} | {comment.body}\n")
try:
comment.edit(".")
comment.delete()
Expand Down
2 changes: 1 addition & 1 deletion web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def api_delete():
created_at = datetime.utcfromtimestamp(comment.created_utc).strftime("%Y-%m-%dT%H:%M:%SZ")
deleted_at = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
with open(DELETED_COMMENTS_FILE, "a", encoding="utf-8") as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.subreddit} | {comment.body}\n")
comment.edit(".")
comment.delete()
deleted_comments += 1
Expand Down
2 changes: 1 addition & 1 deletion weekly_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def main(dry_run: bool = False):
print(f" [DRY RUN] Would delete comment (score={comment.score}) in r/{comment.subreddit}: {comment.body[:80]!r}")
else:
with open("deleted_comments.txt", "a", encoding="utf-8") as f:
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.body}\n")
f.write(f"{deleted_at} | {created_at} | {comment.score} | {comment.subreddit} | {comment.body}\n")
try:
comment.edit(".")
comment.delete()
Expand Down
Loading