Guest User

Untitled

a guest
Mar 22nd, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. import praw
  2. bot = praw.Reddit(user_agent='Ice cream bot',
  3. client_id='dKL76Hnb5j9Byw',
  4. client_secret='d_8MVYMNUvA6HqoxAEp9HS2JEzA',
  5. username='Icecream_above',
  6. password='M0kerlaf1')
  7. subreddit = bot.subreddit('PersonalBotTester')
  8. comments = subreddit.stream.comments()
  9. for comment in comments:
  10. text = comment.body # Fetch body
  11. author = comment.author # Fetch author
  12. def text_open():
  13. text_file=open('c_save.txt', 'a')
  14. text_file.write(text + '\n')
  15. text_file.close()
  16. #if text in open('c_save.txt').read():
  17. #pass
  18. if author == 'Icecream_above': #if the above statement is turned on then this is an elif statement
  19. pass
  20. else:
  21. if 'Icecream_above' in text.lower():
  22. # Generate a message
  23. message = "I am Icecream_above, a bot designed to respond to ice cream,as I am still in the testing phase if you have any questions, comments, or concerns please do not hesitate to contact u/pixelgator.".format(author)
  24. text_open()
  25.  
  26. comment.reply(message) # Send message
  27. elif '#@*#@*#@*#@*#@*#@*#@*#*' in text.lower():
  28. message = "I am Icecream_above, a bot designed to respond to ice cream,as I am still in the testing phase if you have any questions, comments, or concerns please do not hesitate to contact u/pixelgator.".format(author)
  29. text_open()
  30.  
  31. comment.reply(message)
Add Comment
Please, Sign In to add comment