Last active
August 31, 2015 19:19
-
-
Save bholzer/3c57767d748a0bf6be45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw | |
r = praw.Reddit('Homophone Triplet Game by /u/NotFlameRetardant') | |
r.login('HomophoneTripletBot', PASSWORD, disable_warning=True) | |
submission = r.get_submission(submission_id='3j1lso') | |
flat_comments = praw.helpers.flatten_tree(submission.comments) | |
already_done = set() | |
count = 0 | |
wordset = [['there', 'their', 'they\'re'], ['two', 'too', 'to'], ['buy', 'by', 'bye'], ['write', 'right', 'rite']] | |
for comment in flat_comments: | |
if not comment.author: | |
continue | |
if comment.id not in already_done: | |
for i in range(0, len(wordset)): | |
subset = wordset[i] | |
if all(hphones in subset for hphones in comment.body): | |
count += 1 | |
if (count > 0): | |
comment.reply('**' + str(count) + '**\n\nid:' + str(comment.id)) | |
# already_done.add(comment.id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment