コード例 #1
0
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")
コード例 #2
0
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
コード例 #3
0
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)
コード例 #4
0
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
コード例 #5
0
def getAllGamesOnDay(n):
    if n == 0:
        return espnscrape.scrapeESPN(0)
    else:
        with open('discordscorebot/' + str(n) + '.pk1', 'rb') as dayCache:
            return pickle.load(dayCache)