Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 = "python")
- print "Logged in!"
- return r
- def run_bot(r):
- global theCount
- print "Obtaining 25 comments..."
- for comment in r.subreddit('all').comments(limit=300):
- theCount = theCount+1
- if theCount>9999:
- print comment.id
- f = open("history.txt", "r")
- fRead = f.read()
- f.close()
- if comment.id not in fRead:
- f = open("history.txt", "a")
- f.write(comment.id)
- f.close
- try:
- comment.reply("Or you could stop clogging up reddit with shitty posts")
- print "Replied to comment " + comment.id
- theCount = 0;
- except:
- print "Something went wrong!"
- else:
- print "comment ignored! Remeber to clear the logs."
- print "Sleeping for 2 seconds..."
- #Sleep for 10 seconds...
- time.sleep(5)
- while True:
- try:
- theCount = 0
- r = bot_login()
- while True:
- run_bot(r)
- except:
- print "Error! Trying Again."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement