# Path: reddit/redditconstants.py
# WAIT = 10
# 
# SUBREDDIT = "AnalyzeLast100Games+Dota2"
# 
# IGNOREAUTHORS = ["dotamatch", "AnalyzeLast100Games", "Lumbditest"]
# 
# KEYWORDS = ["dotabuff.com/players/", "yasp.co/players/", "opendota.com/players/", "dotabuff.com/matches/", "yasp.co/matches/", "opendota.com/matches/"]
# 
# MAXPOSTS = 100
# 
# CLEANCYCLES = 10
# 
# Path: reddit/workeranalyzecontent.py
# def analyzeContent(post, isPost):
# def RepresentsInt(s):
# 
# Path: reddit/botinfo.py



import time
import sqlite3
import threading
from reddit.redditconstants import WAIT, SUBREDDIT, IGNOREAUTHORS, KEYWORDS, MAXPOSTS, CLEANCYCLES
from reddit import workeranalyzecontent
from reddit.botinfo import message


                cur.execute('SELECT * FROM oldposts WHERE ID=?', [pid])
                if cur.fetchone():
                    if message2: print('[workerfindcomments] already replied to comment')
                    continue

                cur.execute('INSERT INTO oldposts VALUES(?)', [pid])
                sql.commit()


                pbody = post.body.lower()
                if any(key.lower() in pbody for key in KEYWORDS):
                    try:
                        #post.reply('reply success!')

                        if message: print('[@@@][workerfindcomments] starting analyzecontent thread')
                        t = threading.Thread(target=workeranalyzecontent.analyzeContent, args = (post,True,)) #isPost = True
                        t.start()

                    except:
                        if message: print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
                        if message: print('[workerfindcomments] bot could not reply')
                        if message: print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')

            cycles += 1
        except:
            if message: print('[workerfindcomments] Could not search for comments')



# Path: reddit/redditconstants.py
# WAIT = 10
# 
# SUBREDDIT = "AnalyzeLast100Games+Dota2"
# 
# IGNOREAUTHORS = ["dotamatch", "AnalyzeLast100Games", "Lumbditest"]
# 
# KEYWORDS = ["dotabuff.com/players/", "yasp.co/players/", "opendota.com/players/", "dotabuff.com/matches/", "yasp.co/matches/", "opendota.com/matches/"]
# 
# MAXPOSTS = 100
# 
# CLEANCYCLES = 10
# 
# Path: reddit/workeranalyzecontent.py
# def analyzeContent(post, isPost):
# def RepresentsInt(s):
# 
# Path: reddit/botinfo.py



# Path: reddit/workerfindcomments.py
import time
import sqlite3
import threading
from reddit.redditconstants import WAIT, SUBREDDIT, IGNOREAUTHORS, KEYWORDS, MAXPOSTS, CLEANCYCLES
from reddit import workeranalyzecontent
from reddit.botinfo import message



                cur.execute('SELECT * FROM oldposts WHERE ID=?', [pid])
                if cur.fetchone():
                    if message2: print('[workerfindcomments] already replied to comment')
                    continue

                cur.execute('INSERT INTO oldposts VALUES(?)', [pid])
                sql.commit()


                pbody = post.body.lower()
                if any(key.lower() in pbody for key in KEYWORDS):
                    try:
                        #post.reply('reply success!')

                        if message: print('[@@@][workerfindcomments] starting analyzecontent thread')
                        t = threading.Thread(target=workeranalyzecontent.analyzeContent, args = (post,True,)) #isPost = True
                        t.start()

                    except:
                        if message: print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
                        if message: print('[workerfindcomments] bot could not reply')
                        if message: print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')

            cycles += 1
        except:
            if message: print('[workerfindcomments] Could not search for comments')



        if cycles >= CLEANCYCLES: