Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import praw
- import config
- class color:
- BOLD = "\033[1m"
- END = "\033[0m"
- 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 = "repostBot v0.1")
- print "Login successful"
- return r
- def run_bot(r):
- print("Obtaining post URL's")
- #Loop through new posts
- for post in r.subreddit("pics").hot(limit=500):
- #Check if Post URL is already in Top 1000 Posts
- with open("TopPosts") as f:
- for line in f:
- if post.url in line and post.id not in line:
- print(post.title + " https://www.reddit.com/r/pics/" + post.id + '\n')
- original = line
- post.reply("This is a dirty repost, here is the original and the image source: " + original + '\n' + '\n' + "If you think that I don't do my job correctly send me a DM, I dare you")
- r = bot_login()
- run_bot(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement