Skip to content

Instantly share code, notes, and snippets.

@bholzer
Created August 31, 2015 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bholzer/76a8577a410187d03645 to your computer and use it in GitHub Desktop.
Save bholzer/76a8577a410187d03645 to your computer and use it in GitHub Desktop.
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 subset in wordset:
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