From dc3709f489dc2771fa548c3581b02fc58b630bea Mon Sep 17 00:00:00 2001 From: dtcarls Date: Fri, 9 Aug 2019 09:27:35 -0400 Subject: [PATCH] re-add power rankings, more README formatting, upgrade ff_espn_api --- README.md | 24 +++++++++++------------- ff_bot/ff_bot.py | 12 ++++++------ requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 3da68fbb..8539d4c3 100644 --- a/README.md +++ b/README.md @@ -234,29 +234,27 @@ You're done! You now have a fully featured GroupMe/Slack/Discord chat bot for ES Unfortunately to do auto deploys of the latest version you need admin access to the repository on git. You can check for updates on the github page (https://github.com/dtcarls/ff_bot/commits/master) and click the deploy button again; however, this will deploy a new instance and the variables will need to be edited again. #### Private Leagues -For private league you will need to get your swid and espn_s2. -You can find these two values after logging into your espn fantasy football account on espn's website. -(Chrome Browser) -Right click anywhere on the website and click inspect option. +For private league you will need to get your swid and espn_s2. +You can find these two values after logging into your espn fantasy football account on espn's website. +(Chrome Browser) +Right click anywhere on the website and click inspect option. From there click Application on the top bar. -On the left under Storage section click Cookies then http://fantasy.espn.com. -From there you should be able to find your swid and espn_s2 variables and values! +On the left under Storage section click Cookies then http://fantasy.espn.com. +From there you should be able to find your swid and espn_s2 variables and values. ## Troubleshooting / FAQ **League must be full.** +The bot isn't working +Did you miss a step in the instructions? Try doing it from scratch again. If still no luck, post here so the answer can be shared with others. + How are power ranks calculated? -**This feature is currently disabled** -They are calculated using 2 step dominance, as well as a combination of points scored and margin of victory. Weighted 80/15/5 respectively. I wouldn't so much pay attention to the actual number but more of the gap between teams. -Full source of the calculations can be seen here: https://github.com/rbarton65/espnff/blob/master/espnff/utils.py +They are calculated using 2 step dominance, as well as a combination of points scored and margin of victory. Weighted 80/15/5 respectively. I wouldn't so much pay attention to the actual number but more of the gap between teams. Full source of the calculations can be seen here: https://github.com/cwendt94/ff-espn-api/commit/61f8a34de5c42196ba0b1552aa25282297f070c5 Is there a version of this for Yahoo/CBS/NFL/[insert other site]? No, this would require a significant rework for other sites. -The bot isn't working -Did you miss a step in the instructions? Try doing it from scratch again. If still no luck, post here so the answer can be shared with others. - I'm not getting the init message Are you sure you flipped the switch in Heroku to activate the worker (the toggle should be blue)? The other common mistake is misconfigured environment variables. @@ -269,7 +267,7 @@ Specify your variable https://en.wikipedia.org/wiki/List_of_tz_database_time_zon Is there a version of this for Messanger/WhatsApp/[insert other chat]? No, but I am open to pull requests implementing their API for cross platform support. -Like the bot? Consider making a donation to buy me a coffee +Like the bot? Star the repository and consider making a donation to buy me a coffee ------ [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ZDLFECJVGG6RG¤cy_code=USD&source=url) * BTC: 3C8SEcDh52iDSYQY55kwELrNWoQRMkXLCR diff --git a/ff_bot/ff_bot.py b/ff_bot/ff_bot.py index e210fef1..80abed3c 100644 --- a/ff_bot/ff_bot.py +++ b/ff_bot/ff_bot.py @@ -284,7 +284,7 @@ def bot_main(function): print(get_scoreboard(league)) print(get_scoreboard_short(league)) print(get_close_scores(league)) - #print(get_power_rankings(league)) + print(get_power_rankings(league)) print(get_trophies(league)) function="get_final" bot.send_message("Testing") @@ -300,8 +300,8 @@ def bot_main(function): text = get_scoreboard_short(league) elif function=="get_close_scores": text = get_close_scores(league) - #elif function=="get_power_rankings": - # text = get_power_rankings(league) + elif function=="get_power_rankings": + text = get_power_rankings(league) elif function=="get_trophies": text = get_trophies(league) elif function=="get_final": @@ -349,9 +349,9 @@ def bot_main(function): #score update: friday, monday, and tuesday morning at 7:30am local time. #score update: sunday at 4pm, 8pm east coast time. - #sched.add_job(bot_main, 'cron', ['get_power_rankings'], id='power_rankings', - # day_of_week='tue', hour=18, minute=30, start_date=ff_start_date, end_date=ff_end_date, - # timezone=my_timezone, replace_existing=True) + sched.add_job(bot_main, 'cron', ['get_power_rankings'], id='power_rankings', + day_of_week='tue', hour=18, minute=30, start_date=ff_start_date, end_date=ff_end_date, + timezone=my_timezone, replace_existing=True) sched.add_job(bot_main, 'cron', ['get_matchups'], id='matchups', day_of_week='thu', hour=19, minute=30, start_date=ff_start_date, end_date=ff_end_date, timezone=game_timezone, replace_existing=True) diff --git a/requirements.txt b/requirements.txt index 85578b91..ebfe5295 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ flake8==3.3.0 apscheduler>=3.3.0 requests>=2.0.0,<3.0.0 -ff_espn_api>=1.0.4 +ff_espn_api>=1.0.5 diff --git a/setup.py b/setup.py index 0992a530..7088fd8e 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ author_email='deantcarlson@gmail.com', - install_requires=['requests>=2.0.0,<3.0.0', 'ff_espn_api>=1.0.4', 'apscheduler>3.0.0'], + install_requires=['requests>=2.0.0,<3.0.0', 'ff_espn_api>=1.0.5', 'apscheduler>3.0.0'], test_suite='nose.collector',