Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw
- r = praw.Reddit('/u/AbleismBot scanning the SRS Fempire for people using ableist words, and posting replies correcting them.')
- r.login('AbleismBot', censored)
- srsMultiOne = r.get_subreddit('shitredditsays+srsmeta+srsdiscussion+srsmailbag+srsredditdrama+srsgreatesthits+goldredditsays+socialjustice101+srsanarchists+srsbusiness+srsfunny+srshappy+srsimages+srsquestions+srszone+srsaustralia+srsbeliefs+srsbisexual+srsbodytalk+srscanada+srsdeaf+srsdharma+srsdisabilities+srsgsm+srskink+srsmen+srspoc+srsrecovering+srssex+srsskeptic+srssocialism+srstranssupport+srswomen+srsfeminism+srsivorytower+srsnews+srspolitics+srsscience+srstechnology+fitnessplus+srsasoiaf+srsbooks+srsbooze+srscomics+srscycles+srsdramaticreadings+srsfoodies+srsgaming+srsgifs+srsliberty')
- srsMultiOneComments = srsMultiOne.get_comments()
- srsMultiTwo = r.get_subreddit('srslinux+srsmotorcycles+srsmusicals+srspets+srsponies+srsprogramming+srstrees+srstumblr+daww+scifiandfantasy+srsart+srsauthors+srscinema+srsfartsandcrafts+srsmusic+srspoetry+srstelevision')
- srsMultiTwoComments = srsMultiTwo.get_comments()
- ableistWords = [
- " blind to ",
- " turn a blind eye ",
- " blinded by ",
- " crazy ",
- " cretin ",
- " crippled ",
- " daft ",
- " derp ",
- " herp ",
- " dumb ",
- " harelip ",
- " idiotic ",
- " idiot ",
- " imbecile ",
- " insanity ",
- " insane ",
- " invalid ",
- " lame ",
- " lunatic ",
- " loony ",
- " madhouse ",
- " madman ",
- " maniac ",
- " mental case ",
- " mongoloid ",
- " nuts ",
- " psychopathic ",
- " psychopath ",
- " psychotic ",
- " psycho ",
- " retarded ",
- " retard ",
- " tard ",
- " short-bus ",
- " short bus ",
- " simpleton ",
- " spazzed ",
- " spaz ",
- " stupid ",
- " wacko ",
- " whacko "
- ]
- def processComment(comment):
- commentText = comment.body.lower()
- detectedSlurs = [slur.strip() for slur in ableistWords if slur in commentText]
- permlink = comment.permalink
- repliedComments = list(set(open('ableismbotrepliedcomments.txt').read().split("\n")))
- notInList = permlink in repliedComments
- if (len(detectedSlurs) > 0) and ((str)(comment.author) != "AbleismBot") and not permlink in repliedComments:
- replyString = "/u/AbleismBot detected the following ableist words in your comment:\n\n"
- for slur in detectedSlurs:
- replyString += "* " + slur + "\n\n"
- replyString += "For a list of ableist words and their substitutes, go [here.](http://www.autistichoya.com/p/ableist-words-and-terms-to-avoid.html)\n\nThis bot cannot see context, so if you were quoting somebody else, or if you were not using these words in an ableist manner, reply with \"delete\".\n\nBot maintained by /u/Wyboth."
- try:
- comment.reply(replyString)
- writetofile = open("ableismbotrepliedcomments.txt", "a")
- writetofile.write(permlink + "\n")
- writetofile.close()
- except:
- print "Reply failed."
- for comment in srsMultiOneComments:
- processComment(comment)
- for comment in srsMultiTwoComments:
- processComment(comment)
- messages = r.get_inbox()
- for message in messages:
- if message.was_comment and ("delete" in message.body.lower()):
- parent = r.get_info(thing_id=message.parent_id)
- grandparent = r.get_info(thing_id=parent.parent_id)
- if (str)(grandparent.author) == (str)(message.author):
- try:
- parent.delete()
- except:
- print "Couldn't delete.\n"
- print "Program complete."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement