Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import praw
  2. import config
  3. import time
  4.  
  5. def bot_login():
  6. print "Loggin in..."
  7. r = praw.Reddit(username = config.username,
  8. password = config.password,
  9. client_id = config.client_id,
  10. client_secret = config.client_secret,
  11. user_agent = “abe’s mushroom spambot”)
  12. print "Logged in!"
  13.  
  14. return r
  15.  
  16. def run_bot(r):
  17. print "Obtaining 25 comments..."
  18. for comment in r.all(‘test').comments(limit=25):
  19. if “mushroom” in comment.body:
  20. print "String with \”mushroom\” found in comment " + comment.id
  21. comment.reply(“>mushroom Fuck Mushrooms /r/mushroomhate“)
  22. print "Replied to comment " + comment.id
  23.  
  24. print "Sleeping for 10 seconds..."
  25. #Sleep for 10 seconds...
  26. time.sleep(10)
  27.  
  28.  
  29. r = bot_login()
  30. while True:
  31. run_bot(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement