Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import config
- def bot_login():
- print ("Logging in...")
- r = praw.Reddit(username = config.username,
- password = config.password,
- client_id = config.client_id,
- client_secret = config.client_secret,
- user_agent = "kree's dog comment responder v0.1")
- print ("Successfullly logged in!")
- return r
- def run_bot(r):
- for comment in r.subreddit('test').comments(limit=25):
- if "dog" in comment.body:
- print ("String found!")
- if __name__ == '__main__':
- print("Hi there!")
- r = bot_login()
- run_bot(r)
- //Terminal Output
- //Kevins-MacBook-Pro:Reddit_Dog_bot kevinlee$ python reddit_dog_bot.py
- //Kevins-MacBook-Pro:Reddit_Dog_bot kevinlee$ python reddit_dog_bot.py
- //Kevins-MacBook-Pro:Reddit_Dog_bot kevinlee$ python reddit_dog_bot.py
- //Kevins-MacBook-Pro:Reddit_Dog_bot kevinlee$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement