Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- BOT_NAME = 'The Good Place No-Flair Janet'
- VERSION_NUMBER= '0.1'
- USER_AGENT = BOT_NAME + ' ' + VERSION_NUMBER + ', a service bot for this account written by u/kungming2.'
- SUBREDDIT = "thegoodplace"
- USER_NAME = ""
- print('\n|======================Logging in...======================|')
- reddit = praw.Reddit(client_id="",
- client_secret="", password='',
- user_agent=USER_AGENT, username=USER_NAME)
- def check_for_unflaired():
- posts_unflaired_lines = []
- line_template = "* [{}]({})"
- posts = []
- posts += reddit.subreddit(SUBREDDIT).new(limit=100)
- for post in posts:
- if post.link_flair_text is None:
- new_line = line_template.format(post.title, post.permalink)
- posts_unflaired_lines.append(new_line)
- if len(posts_unflaired_lines) > 0:
- header = "\n### {} unflaired posts on r/{}:\n\n".format(len(posts_unflaired_lines), SUBREDDIT)
- returned_text = header + '\n'.join(posts_unflaired_lines)
- else:
- returned_text = "No unflaired posts found on r/{}.".format(SUBREDDIT)
- return returned_text
- print(check_for_unflaired())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement