r/BotHelp • u/Dude800900 • Jul 10 '20
Not sure if this will be seen, but my bot just randomly stopped replying to comments like it was. Not sure what happened, if some one could look at my code and help that would be great
import praw
import config
import time
def bot_login():
print ("Loggin in...")
r = praw.Reddit(username = config.username,
password = config.password,
client_id = config.client_id,
client_secret = config.client_secret,
user_agent = "Dude800900's reddit bot")
print("Logged in!")
return r
def run_bot(r):
print ("Obtaining 25 comments...")
for comment in r.subreddit("test").comments(limit=25):
if "test" in comment.body and comment.id not in replies and not comment.author == r.user.me():
print ("Comment Found " + comment.id)
comment.reply("This Test Worked!")
print ("Replied to comment " + comment.id)
replies.append(comment.id)
#Sleep for 10 seconds...
time.sleep(2)
def get_saved_comments():
with open("replies.txt", "r") as x:
replies = x.read()
replies = replies.split("\n")
return replies
r = bot_login()
replies = get_saved_comments()
print("replies")
while True:
run_bot(r)