async def allgames(): try: allGamesString = '' for game in espnscrape.scrapeESPN(0): allGamesString += buildGameString(game) + '\n' await client.say(allGamesString) except Exception as e: print(str(e)) await client.say("Error Occured")
def buildScoreString(team): allgames = espnscrape.scrapeESPN(0) for game in allgames: if team in gameTeams(game): gamestring = buildGameString(game) print(gamestring) return gamestring scheduleString = buildScheduleString(team, includeToday=False) return "There are currently no games scheduled for " + team + " today.\n" + scheduleString
def cacheGames(): for n in range(-7, 8): if n == 0: # Don't use a cache for today since the results will most likely be changing continue scrapeESPN(n)
def createnewlog(): games = scrapeESPN(0) with open('discordscorebot/gamelog.txt','w') as f: for game in games: f.write(game['tid1'] + "," + game['tid2'] + "," + '0,0,0,0,0,0\n') #tid1,tid2,10-1h,half,10-2h,5-2h,2-2h,final
def getAllGamesOnDay(n): if n == 0: return espnscrape.scrapeESPN(0) else: with open('discordscorebot/' + str(n) + '.pk1', 'rb') as dayCache: return pickle.load(dayCache)