Created
November 5, 2020 15:21
-
-
Save jacks0n9/da946a2d3a496b1005bb11b74595f863 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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