Advertisement
Guest User

Untitled

a guest
Aug 4th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1.  
  2.  
  3. ####################### reddit bot ############################
  4. import time
  5. import praw
  6. import config
  7. ####### REDDIT Credentials #############
  8.  
  9. def reddit_cred():
  10.  
  11. r = praw.Reddit(username = config.username,
  12. password = config.password,
  13. client_id = 'UYdWXwNAMaHuRw',
  14. client_secret = 'IB1yLBIiXqXdd-fP6xM_eRrmdr8',
  15. redirect_uri = 'https://www.whiterabot.com',
  16. user_agent = 'lionsarmor')
  17.  
  18. return (r)
  19.  
  20. r = reddit_cred()
  21.  
  22. ###### Functions
  23.  
  24. def intro():
  25. print("******************************************\n\n\nWelcome to the reddit term search and poster!\n\n\n\n**************************************** ")
  26.  
  27. def post_red(r):
  28.  
  29. red = (input("Enter a subreddit: "))
  30. term = (input("enter the term you want to find in the subreddit: "))
  31. # option to hardcode a list of search terms instead of entering a single search term.
  32. list = ['automation, desktop automation', 'white rabot','freelancer programmer wanted', 'Programmer wanted', 'program for cash' ]
  33. for submission in r.subreddit(red).comments(limit=10):
  34. if (term) in submission.body:
  35. print("match...")
  36. time.sleep(2)
  37. stor = (input("What would you like to send to the match reddit posts?"))
  38. submission.reply(stor)
  39. break
  40.  
  41. else:
  42. print("No match try again")
  43.  
  44. break
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. ### Function calls
  52. intro()
  53.  
  54. reddit_cred()
  55.  
  56. post_red(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement