Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import config
- import time
- def authenticate():
- print("Authenticating...")
- reddit = praw.Reddit(username = config.username,
- password = config.password,
- client_id = config.client_id,
- client_secret = config.client_secret,
- user_agent="Lol_Reply_Bot made by /u/brodydrey2296 v1.0")
- print("Authenticated as {}".format(reddit.user.me()))
- return reddit
- def main():
- reddit = authenticate()
- while True:
- run_bot(reddit)
- def run_bot(reddit):
- print("Obtaining 25 comments...")
- for comment in reddit.subreddit('all').comments(limit=25):
- if "lol" in comment.body:
- print ("String with 'lol' found in comment " + comment.id)
- comment.reply("The only reason people say lol is because it's kind of funny, but not funny enough to have any other sort of reaction than saying"
- "lol'")
- print("Replied to comment") + comment.id
- print("Sleeping for 10 seconds...")
- time.sleep(10)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement