Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- import datetime
- import config
- import time
- title = "Thank you for posting to /r/Aquariums"
- message = "Thank you for posting to our subreddit. We want to remind you to please **flair your submission with an appropriate link flair**. If you are on desktop the flair option can be found under the title of your post. On mobile applications it will be with your other post options (delete, save, share, etc)
- def bot_login():
- reddit = praw.Reddit(username = config.username,
- password = config.password,
- client_id = config.client_id,
- client_secret = config.client_secret,
- user_agent = "Aquarium Bot v0.1")
- return reddit
- def run_bot(reddit):
- for submission in reddit.subreddit('AquariumsTestSub').new(limit=20):
- posttime = get_dif(submission)
- if posttime > datetime.timedelta(minutes=10) and posttime < datetime.timedelta(minutes=12) and submission.link_flair_text is None:
- submission.author.message(title, message)
- def get_dif(submission):
- date = datetime.datetime.fromtimestamp(submission.created_utc)
- dif = datetime.datetime.utcnow() - date
- return dif - datetime.timedelta(hours=4)
- reddit = bot_login()
- while True:
- run_bot(reddit)
- print "Done loop!"
- time.sleep(118)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement