Skip to content

Instantly share code, notes, and snippets.

@jacks0n9
Created November 5, 2020 15:21
Show Gist options
  • Save jacks0n9/da946a2d3a496b1005bb11b74595f863 to your computer and use it in GitHub Desktop.
Save jacks0n9/da946a2d3a496b1005bb11b74595f863 to your computer and use it in GitHub Desktop.
import praw
import pdb
import re
import os
reddit = praw.Reddit('bot1')
if not os.path.isfile("posts_replied_to.txt"):
posts_replied_to = []
with open("posts_replied_to.txt", "r") as f:
posts_replied_to = f.read()
posts_replied_to = list(filter(None, posts_replied_to))
subreddit = reddit.subreddit("justtestingmybot")
for submission in subreddit.new():
if submission.id not in posts_replied_to:
posts_replied_to.append(submission.id)
submission.reply("Hi there. I am a bot in testing phase.")
submission.upvote()
with open("posts_replied_to.txt", "w") as f:
f.write(str(posts_replied_to))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment