Skip to content

Commit 671f0ec

Browse files
committed
Modified comments
1 parent 26596e8 commit 671f0ec

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

cmd/deleteRedditHistory/main.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 2025 Michael Plunkett (https://github.com/michplunkett)
33
* All rights reserved.
4-
* Used to delete Reddit history of a given user.
4+
* Used to delete Reddit user posts and comments older than a given threshold date.
55
*/
66

77
package main
@@ -53,18 +53,17 @@ func main() {
5353

5454
credentials := reddit.Credentials{ID: e.appID, Secret: e.appSecret, Username: e.userName, Password: e.userPassword}
5555
cli, clientErr := reddit.NewClient(credentials)
56-
5756
if clientErr != nil {
5857
log.Fatal(clientErr)
5958
}
6059

6160
// Get overview of user
62-
commentService := *cli.Comment
63-
postService := *cli.Post
61+
_ = *cli.Comment
62+
_ = *cli.Post
6463
userService := *cli.User
6564

6665
// Get all posts
67-
fmt.Println("------- Pulling user posts. -------")
66+
fmt.Println("------- Pulling user posts")
6867

6968
lastPostID := ""
7069
postIds := make([]string, 0)
@@ -80,7 +79,6 @@ func main() {
8079
postOptions.ListOptions.After = lastPostID
8180
}
8281

83-
fmt.Println("Pulling more posts.")
8482
posts, _, err := userService.Posts(ctx, postOptions)
8583
if err != nil {
8684
log.Fatal(err)
@@ -93,7 +91,6 @@ func main() {
9391
for _, post := range posts {
9492
if post.Created.Time.Before(THRESHOLD) ||
9593
post.Created.Time.Equal(THRESHOLD) {
96-
fmt.Println(post.Created)
9794
postIds = append(postIds, post.FullID)
9895
}
9996
}
@@ -102,7 +99,7 @@ func main() {
10299
}
103100

104101
// Delete all posts
105-
fmt.Println("------- Deleting user posts. -------")
102+
fmt.Println("------- Deleting user posts:", len(postIds))
106103
for _, pID := range postIds {
107104
fmt.Println(pID)
108105
//_, err := postService.Delete(ctx, pID)
@@ -112,7 +109,8 @@ func main() {
112109
}
113110

114111
// Get all comments
115-
fmt.Println("------- Pulling user comments. -------")
112+
fmt.Println("------- Pulling user comments")
113+
116114
lastCommentID := ""
117115
commentIds := make([]string, 0)
118116
commentOptions := &reddit.ListUserOverviewOptions{
@@ -127,7 +125,6 @@ func main() {
127125
commentOptions.ListOptions.After = lastCommentID
128126
}
129127

130-
fmt.Println("Pulling more comments.")
131128
comments, _, err := userService.Comments(ctx, commentOptions)
132129
if err != nil {
133130
log.Fatal(err)
@@ -148,7 +145,8 @@ func main() {
148145
}
149146

150147
// Delete all comments
151-
fmt.Println("------- Deleting user comments. -------")
148+
fmt.Println("------- Deleting user comments:", len(commentIds))
149+
152150
for _, cID := range commentIds {
153151
fmt.Println(cID)
154152
//_, err := commentService.Delete(ctx, cID)

0 commit comments

Comments
 (0)