# Path: botcommands/averagelastxgames.py
# def averageLastXGames(playerID, amount=100, detailedAnalysis=False, heroID=None, gameModeID=None, tournamentGamesOnly=False, getMMR=True):
# def analyzeMatches(playerID, detailedMatches):
# def addStatsTogether(storage, player, addTogether):
# def testBit(int_type, offset):
# def amountOfTowersDestroyed(tower_status):
# def amountOfBarracksDestroyed(barracks_status):
# 
# Path: botcommands/match.py
# def match(matchID):
# 
# 
#     t = threading.Thread(target=requestparsematch.requestParseMatch, args = (matchID,))
#     t.start()
# 
#     matchJson = getmatchdetails.getMatchDetails(matchID)
# 
#     accountIDs = []
#     for player in matchJson['result']['players']:
#         accountIDs.append(player['account_id'])
# 
#     playerSummariesJson = getplayersummaries.getPlayerSummaries(accountIDs)
# 
#     reply = drmatch.displayResult(matchJson, playerSummariesJson)
# 
#     return reply
# 
# Path: botcommands/odotachat.py
# def odotaChat(matchID):
# 
# Path: steamapi/getheroes.py
# def requestGetHeroes():
#     URL = "https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/?key=" + SteamAPIKey + "&language=en_us"
# 
# Path: reddit/botinfo.py

# 
# Path: steamapi/getheroes.py
# def requestGetHeroes():
#     URL = "https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/?key=" + SteamAPIKey + "&language=en_us"


from botcommands import averagelastxgames, match, odotachat
from steamapi import getheroes
from reddit.botinfo import message,botName
from steamapi import getheroes
import time
import re

        for m in re.finditer(pattern, text, re.I):
            if commandCounter < 3:                      #Reddit has character limit, only have room for 3 player analysis
                playerID = m.group('playerID')
                if playerID not in analyzedPlayers:
                    queryParameters = m.group('queryParameters')
                    website = m.group('website')
                    heroID = None
                    gameModeID = None
                    if queryParameters != None and (website == 'opendota.com' or website == 'yasp.co'):
                        try:
                            n = re.search(patternHero, queryParameters, re.I)
                            if n != None:
                                heroID = n.group('heroID')
                            n = re.search(patternGameMode, queryParameters, re.I)
                            if n != None:
                                gameModeID = n.group('gameModeID')
                        except:
                            print('[workeranalyzecontent] OpenDota hero filtering crashed, needs investigation')
                    if queryParameters != None and (website == 'dotabuff.com'):
                        try:
                            n = re.search(patternHero, queryParameters, re.I)
                            if n != None:
                                heroID = n.group('heroID')
                                reverseDBHeroDictionary = {v:k for k,v in getheroes.heroDictionaryDotabuff.items()}
                                heroID = reverseDBHeroDictionary[heroID]
                        except:
                            print('[workeranalyzecontent] Dotabuff hero filtering crashed, needs investigation')

                    try:

# Path: botcommands/averagelastxgames.py
# def averageLastXGames(playerID, amount=100, detailedAnalysis=False, heroID=None, gameModeID=None, tournamentGamesOnly=False, getMMR=True):
# def analyzeMatches(playerID, detailedMatches):
# def addStatsTogether(storage, player, addTogether):
# def testBit(int_type, offset):
# def amountOfTowersDestroyed(tower_status):
# def amountOfBarracksDestroyed(barracks_status):
# 
# Path: botcommands/match.py
# def match(matchID):
# 
# 
#     t = threading.Thread(target=requestparsematch.requestParseMatch, args = (matchID,))
#     t.start()
# 
#     matchJson = getmatchdetails.getMatchDetails(matchID)
# 
#     accountIDs = []
#     for player in matchJson['result']['players']:
#         accountIDs.append(player['account_id'])
# 
#     playerSummariesJson = getplayersummaries.getPlayerSummaries(accountIDs)
# 
#     reply = drmatch.displayResult(matchJson, playerSummariesJson)
# 
#     return reply
# 
# Path: botcommands/odotachat.py
# def odotaChat(matchID):
# 
# Path: steamapi/getheroes.py
# def requestGetHeroes():
#     URL = "https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/?key=" + SteamAPIKey + "&language=en_us"
# 
# Path: reddit/botinfo.py

# 
# Path: steamapi/getheroes.py
# def requestGetHeroes():
#     URL = "https://api.steampowered.com/IEconDOTA2_570/GetHeroes/v0001/?key=" + SteamAPIKey + "&language=en_us"


# Path: reddit/workeranalyzecontent.py
from botcommands import averagelastxgames, match, odotachat
from steamapi import getheroes
from reddit.botinfo import message,botName
from steamapi import getheroes
import time
import re


        for m in re.finditer(pattern, text, re.I):
            if commandCounter < 3:                      #Reddit has character limit, only have room for 3 player analysis
                playerID = m.group('playerID')
                if playerID not in analyzedPlayers:
                    queryParameters = m.group('queryParameters')
                    website = m.group('website')
                    heroID = None
                    gameModeID = None
                    if queryParameters != None and (website == 'opendota.com' or website == 'yasp.co'):
                        try:
                            n = re.search(patternHero, queryParameters, re.I)
                            if n != None:
                                heroID = n.group('heroID')
                            n = re.search(patternGameMode, queryParameters, re.I)
                            if n != None:
                                gameModeID = n.group('gameModeID')
                        except:
                            print('[workeranalyzecontent] OpenDota hero filtering crashed, needs investigation')
                    if queryParameters != None and (website == 'dotabuff.com'):
                        try:
                            n = re.search(patternHero, queryParameters, re.I)
                            if n != None:
                                heroID = n.group('heroID')
                                reverseDBHeroDictionary = {v:k for k,v in getheroes.heroDictionaryDotabuff.items()}
                                heroID = reverseDBHeroDictionary[heroID]
                        except:
                            print('[workeranalyzecontent] Dotabuff hero filtering crashed, needs investigation')

                    try:

                        partialReply += str(averagelastxgames.averageLastXGames(int(playerID), amount=100, detailedAnalysis=False, heroID=heroID, gameModeID=gameModeID, getMMR=True))