Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- bot = praw.Reddit(user_agent='Ice cream bot',
- client_id='dKL76Hnb5j9Byw',
- client_secret='d_8MVYMNUvA6HqoxAEp9HS2JEzA',
- username='Icecream_above',
- password='M0kerlaf1')
- subreddit = bot.subreddit('PersonalBotTester')
- comments = subreddit.stream.comments()
- for comment in comments:
- text = comment.body # Fetch body
- author = comment.author # Fetch author
- def text_open():
- text_file=open('c_save.txt', 'a')
- text_file.write(text + '\n')
- text_file.close()
- #if text in open('c_save.txt').read():
- #pass
- if author == 'Icecream_above': #if the above statement is turned on then this is an elif statement
- pass
- else:
- if 'Icecream_above' in text.lower():
- # Generate a message
- 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)
- text_open()
- comment.reply(message) # Send message
- elif '#@*#@*#@*#@*#@*#@*#@*#*' in text.lower():
- 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)
- text_open()
- comment.reply(message)
Add Comment
Please, Sign In to add comment