Information and requests for One Bleachin Bot

''' Created on Jul 12, 2014

@author: su5 bitches '''

import time #tracking purposed import re #prolly gonna be useful import random import praw # for reddit import imgurpython

CLIENT_ID = "23660b9c5325d50" CLIENT_SECRET = "69b3756902affa34bf32e68077fb2275bd453589" # Needed for step 2 and 3 me = imgurpython.ImgurClient(CLIENT_ID, CLIENT_SECRET) mySheeeeit = me.get_album_images('FlHzl')

done = [] doneSub = [] message = """NSFL? Yikes!

[Eye bleach!](""" messageEnd = """

I am a robit. """ usn = 'onebleachinbot' r = praw.Reddit(user_agent='EyeBleach') specialSubs = {"fatpeoplehate":"hEhJG", "mylittlepony":"gvJ0e", "cars":"Rt2DI"} print("logging in") r.login() print("logged in") trigger = 'NSFL' i = 0 j=0 co=0 k=0 reso = 100000 tlast = time.clock() comments = r.get_comments('all') Album = me.get_album_images('FlHzl') while False: link = Album[random.randrange(0,len(Album),1)].link views = 0 for things in Album: views+=things.views print(views)

while True:

try:
    if ( ( time.clock()-tlast ) > 2 ):
        #print(i)
        tlast = time.clock()
        sub = r.get_subreddit("all")
        comments = sub.get_comments(limit=None)
    for c in comments:
        i+=1

        if str(c.author).lower() != usn and c.id not in done and not c.is_root:   
            if trigger.lower() in c.body.lower():
                if c.submission.id not in doneSub:
                    try:
                        cp = r.get_info(thing_id=c.parent_id)
                    except:
                        pass
                    try:
                        if str(c.subreddit).lower() in specialSubs:
                            location = specialSubs[str(c.subreddit).lower()]
                            Album = me.get_album_images(location) 
                        else:
                            Album = me.get_album_images('FlHzl') 
                        link = Album[random.randrange(0,len(Album),1)].link
                        print(link)
                        print("found one      ")
                        print(c.body)  
                        done.append(c.id)
                        k+=1
                        print(k)
                        #if str(c.author) == "su5": 
                        if "http" in c.body.lower() or "www" in c.body.lower() or '/r/' in c.body.lower() :
                            try:
                                #r.send_message( 'su5', 'Found a shitter',c.permalink+'  '+ c.body + '  ' + str( c.author ) + message + link +") " +  messageEnd)
                                pass
                            except:
                                print( "message problem")
                            try:
                                c.reply(message + link +") " +  messageEnd)
                                doneSub.append(c.submission.id)
                            except:
                                print("com fail")
                        else:
                            if "http" in cp.body.lower() or '/r/' in cp.body.lower() or "www" in cp.body.lower() and cp.id not in done and not str(cp.author).lower() == "onebleachinbot":
                                try:
                                    pass
                                    #r.send_message( 'su5', 'Found a callout',cp.permalink+'  '+ cp.body + '  ' + str( cp.author ) + message + link +") " +  messageEnd)
                                except:
                                    print( "message problem")
                                try:
                                    cp.reply(message + link +") " +  messageEnd)
                                    done.append(c.parent_id)
                                    doneSub.append(c.submission.id)
                                except:
                                    print("com fail")
                                done.append(c.parent_id)
                            else:
                                try:
                                    pass
                                    #r.send_message( 'su5', 'Found a i dont know what',cp.permalink+'  '+ cp.body + '  ' + str( cp.author ) + message + link  +") "+  messageEnd)
                                except:
                                    print( "message problem")
                                try:
                                    #c.reply(message + link  +") "+  messageEnd)
                                    done.append(c.parent_id)
                                    doneSub.append(c.submission.id)
                                except:
                                    print("com fail")  
                    except:
                        print('couldnt respond')
                else:
                    print("already been here")
                    done.append(c.id)
        if i%reso == 0:
            j+=1
            i=0
            views = 0
            Album = me.get_album_images('FlHzl') 
            for thing in Album:
                views+=thing.views

            print("We have hit " + str(k) + " items and have had " + str(views) +" views")


except:
    print("somewhere error")
/r/IAmARobit Thread