dtcarls / fantasy_football_chat_bot Goto Github PK
View Code? Open in Web Editor NEWGroupMe Discord and Slack Chatbot for ESPN Fantasy Football
License: GNU General Public License v3.0
GroupMe Discord and Slack Chatbot for ESPN Fantasy Football
License: GNU General Public License v3.0
Hey, I have everything almost up and running on Heroku, but for some reason, I'm getting access denied when starting up.
I'm able to run it locally and see my test message coming in just fine. I believe all of my environment variables are the exact same. I've triple checked this.
Any ideas?
One of the "close scores" is showing an incorrect score.
Close Scores
TEAM 111.56 - 114.40 PUTY
DUCK 72.54 - 85.56 NATE
The first score for TEAM shows 111.56 but the actual score for that team is 102.6. They have no one else playing tonight so their projected score also shows 102.6. Not sure where 111.56 is coming from, no team has that score.
Re-deployed the latest bot on Friday for Discord.
Leagues must be publicly view able for it to currently work.
Describe the bug
When the message for updated scores went out on Friday morning they were all 0 points. (See attached image)
To Reproduce
Have teams score points and then have the bot send the score update
Expected behavior
Expected a updated score board with Thursday night football scores
Chat application
GroupMe
Additional context
N/A
Ensure all environment variables are at least handled to be undefined or empty strings
Scoreboard is reflecting thursday scores on each score update
Describe the bug
When a player is projected to score more than 0 but then scores 0 the projection overrides the actual score.
To Reproduce
OJ Howard week 2
Expected behavior
After a game has ended if the player remains with 0 points, use that instead of projected.
Describe the bug
Score update has scores for a matchup that are too high for both teams.
Screenshots
Message text copied from Slack:
Actual Score Update
SHIT 123.16 - 53.16 8==D
SABA 50.56 - 61.34 WALK
HELP 99.50 - 103.62 CUT
TRM 153.38 - 67.70 BOMB
BURN 118.72 - 102.34 DEAD
Free 135.54 - 95.20 ROMO
BERB 118.62 - 49.92 MEAT
From ESPN app, the third score should be: HELP 86.5 - 88.6 CUT
Chat application
Slack
Additional context
LEAGUE_ID=14434
SWID=D2B41879-14A0-47CC (modified to keep information private)
ESPN_S2=AEArqDpgkK5KQaO2 (modified to keep information private)
Describe the bug
Actual Score Update (7:30AM EST) update is last week's scores.
Expected behavior
Should show only scores from the Thursday Night Game
Is there a way to call the bot to force post? For example, I type in "/ffbot_scores" will return the current scores of each matchup. Or "ffbot_rankings" will return the most recent power rankings.
you said updates at 430/730 but looking at code you send at 16,20
Add environment variables to make each message type optional, defaulting to true.
Describe the bug
When the message for updated scores went out on Monday they were all 0 points. (See attached image)
To Reproduce
Have teams score points and then have the bot send the score update
Expected behavior
Expected an updated scoreboard with up-to-date football scores as reflected in ESPN
Chat application
GroupMe
Additional context
Sorry if this doesn't belong here. I'm probably doing something wrong, but when I click the Heroku Deploy button, it just sends me to the Heroku login page, even when I'm already logged in.
I feel like when I clicked the button previously, it would open up a deploy window on Heroku.
Is your feature request related to a problem? Please describe.
Tedious and confusing to pull out swid and espn_s2.
Describe the solution you'd like
Add option for username and password parameters, but leave espn_s2 and swid for privacy.
Will need to scrape HTML to get projected scores.
Power rankings need to be manually updated each week until rbarton65/espnff#31 is resolved and rbarton65/espnff#32 is accepted
Top score
Lowest score
Biggest loss
Closest game
Any update for 2020 Leagues? This doesn't seem to be working anymore, perhaps due to the ESPN layout change. Trying this with a 2020 baseball league, but no luck.
1st week completion of 2 week playoff displays wrong summary statistics.
Discord message:
https://i.imgur.com/togrhXc.png?1
This week's actual scores/matchups on ESPN:
https://i.imgur.com/JFqkzZp.png?1
https://i.imgur.com/OPsJTam.png?1
Is your feature request related to a problem? Please describe.
Hey there! I'm Erik, a developer of another Python GroupMe bot. Motivated by frustration I experienced with building that bot, I recently developed MeBots, which is a platform/API for building GroupMe bots more easily. It's designed to abstract away some of the headaches of maintaining GroupMe bots so that your job as a developer will be a little easier. For example, it has a whole built-in panel for adding and removing bots from different groups, and then it stores all the bot IDs and stuff in a database for you so you won't need to worry about keeping track of that data; you can just get what you need through a web API. Also, other people can add the bot to their own groups if you so choose. I think your bot could be of available to more people if it's on that marketplace and can be easily added by non-technical users.
Describe the solution you'd like
I've written up some documentation for how to integrate with the API here: http://mebots.co/documentation. This would not be a complex change: each time a message was sent to a chat, there would just be one simple API request to check which bot_id to send with, and the website takes care of all the adding/removing logic for you!
I wrote some more specific documentation in the README of a pip package I made for easy integration with the API, which you can find here, and there's a complete bot implementation here! I'm happy to make a PR integrating with the platform as well or answer any questions you may have about tradeoffs.
Describe alternatives you've considered
The alternative is to leave it as it is now—users would have to continue going into the GroupMe developer website and manually creating the bot and giving their token, etc.
Seeing some SSL errors this evening, curious if anyone else experienced the same thing, or if it could be my environment.
I rebuilt the latest docker image from master today and re-deployed (running on local linux machine). Have been running the bot without this issue in prior weeks.
Job "bot_main (trigger: cron[day_of_week='sun', hour='16,20'], next run at: 2019-09-29 16:
00:00 EDT)" raised an exception
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3-1.25.5-py3.7.egg/urllib3/connection
pool.py", line 672, in urlopen
chunked=chunked,
File "/usr/local/lib/python3.7/site-packages/urllib3-1.25.5-py3.7.egg/urllib3/connection
pool.py", line 376, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.7/site-packages/urllib3-1.25.5-py3.7.egg/urllib3/connection
pool.py", line 994, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3-1.25.5-py3.7.egg/urllib3/connection
.py", line 394, in connect
ssl_context=context,
File "/usr/local/lib/python3.7/site-packages/urllib3-1.25.5-py3.7.egg/urllib3/util/ssl_.
py", line 370, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/local/lib/python3.7/ssl.py", line 423, in wrap_socket
session=session
File "/usr/local/lib/python3.7/ssl.py", line 870, in _create
self.do_handshake()
File "/usr/local/lib/python3.7/ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests-2.22.0-py3.7.egg/requests/adapters
.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3-1.25.5-py3.7.egg/urllib3/connection
pool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/usr/local/lib/python3.7/site-packages/urllib3-1.25.5-py3.7.egg/urllib3/util/retry
.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='fantasy.espn.com', port=443):
Max retries exceeded with url: /apis/v3/games/FFL/seasons/2019/segments/0/leagues/14434 (C
aused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:10
76)')))
Tuesday morning final scores sends all zeroes. Also roll up final score update and trophies into 1 message.
Have been using the bot for 2 seasons (thanks! its such great work), but this year when I erased and remade my Heroku deployment, I'm not seeing an init message. I've double checked the Webhooks using curl
and they seem to be working correctly. I've also confirmed all my config vars are setup correctly, but I must be missing something.
Any help is appreciated!
Describe the bug
It's week two of the season and the BOT is posting week one scores still
To Reproduce
Load the bot and let it run
Expected behavior
Scores should always be current.
Screenshots
If applicable, add screenshots to help explain your problem.
Chat application
SLACK
Additional context
Add any other context about the problem here.
Matchups message broken. The new line broke it.
2017-09-21T23:30:00.743025+00:00 app[worker.1]: Traceback (most recent call last): 2017-09-21T23:30:00.743029+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/apscheduler/executors/base.py", line 125, in run_job 2017-09-21T23:30:00.743005+00:00 app[worker.1]: Job "bot_main (trigger: cron[day_of_week='thu', hour='19', minute='30'], next run at: 2017-09-28 19:30:00 EDT)" raised an exception 2017-09-21T23:30:00.743030+00:00 app[worker.1]: retval = job.func(*job.args, **job.kwargs) 2017-09-21T23:30:00.743031+00:00 app[worker.1]: File "ff_bot/ff_bot.py", line 114, in bot_main 2017-09-21T23:30:00.743032+00:00 app[worker.1]: text = get_matchups(league) 2017-09-21T23:30:00.743033+00:00 app[worker.1]: File "ff_bot/ff_bot.py", line 71, in get_matchups 2017-09-21T23:30:00.743034+00:00 app[worker.1]: text = ['This Week\'s Matchups'] + score + '\n' + random_phrase() 2017-09-21T23:30:00.743757+00:00 app[worker.1]: TypeError: can only concatenate list (not "str") to list
Yes -- Post update from this week the bot is displaying 00 for all scores and trophies.
I followed the instructions step by step. I created the bot and verified it worked in my groupme chat then deployed the bot using the heroku link. Everything looked to be working after I amended the variables to my fantasy league and bot ID. When I turned it on, I never got an initial message in my groupme chat so I assume it did not link correctly. Any troubleshooting help here would be much appreciated.
Would love to see an optional addition for league activity. Specifically added/dropped players.
Also pulling from the league activity - would like to be able to pull team name changes. Currently manually changing nicknames in Discord to match team names in the league.
Is your feature request related to a problem? Please describe.
The problem that I see is that a discord message is sent in a very bot-like format (fixed-width text, minimal formatting, etc.)
Describe the solution you'd like
utilize a form of discord embeds that allows a message to be send in a prettified format. This would require sending a special object in a discord request includes formatting data. For an example of what an embedd looks like, and the code thats included in it, see this link
Describe alternatives you've considered
that specific object is required for pretty embedding.
Additional context
Here's an example of how discord.js does embeds. From looking at this code, it looks like there's no integration with a discord python library, so some work around making an object in python that includes embedding would be necessary
On the thursday night message for the upcoming week of matchups, the projected scores are for the previous week.
Reinstalled new version on 9/22/2019.
9/24/19 morning trophy message worked. No changes were made to Heroku or Groupme after this point.
Both bots ( I utilize two of them ) did not send power ranking messages.
I went to check my log after my init_msg wouldn't send and it says this:
2020-09-22T17:26:33.261563+00:00 app[api]: Release v12 created by user [email protected]
2020-09-22T17:26:33.261563+00:00 app[api]: Set INIT_MSG config vars by user [email protected]
2020-09-22T17:26:33.325115+00:00 app[worker.1]: Error waiting for network: Resource temporarily unavailable
2020-09-22T17:26:33.471820+00:00 heroku[worker.1]: State changed from down to starting
2020-09-22T17:26:36.438771+00:00 heroku[worker.1]: Starting process with command python3 ff_bot/ff_bot.py
2020-09-22T17:26:37.123708+00:00 heroku[worker.1]: State changed from starting to up
2020-09-22T17:26:37.132792+00:00 heroku[worker.1]: Idling
2020-09-22T17:26:37.135282+00:00 heroku[worker.1]: State changed from up to down
2020-09-22T17:26:37.144044+00:00 heroku[worker.1]: Idling because quota is exhausted
2020-09-22T17:26:43.317850+00:00 app[worker.1]: Error waiting for network: Resource temporarily unavailable
any reason why it wouldn't work based off of this log?
I'm in the process of activating the bot for a second GroupMe (1st works correctly)
I have gone through the steps a few times, and have included the SWID and ESPN_s2 variable; however, I am wondering if the issue is that I am not the Owner of the Groupme channel?
I was able to add the GroupMe bot to the group successfully, but it won't post the INIT message, so I don't think it's connected.
Any help is greatly appreciated!
Is your feature request related to a problem? Please describe.
Due to the EPSN API Week 5 issues, I needed to create another Docker image in order to grab the most recent power rankings and trophies for our league. This required changed the ff_bot.py to true and creating another Docker image, to get the log files for the updates.
Describe the solution you'd like
I'd love the test printout mode to be togglable from the environment variables. But still defaulted to false for general use. That way I could start up a docker container with
docker run --rm=True \
-e ESPN_S2=TOKEN \
-e SWID=TOKEN \
-e LEAGUE_ID=$LEAGUE_ID \
-e LEAGUE_YEAR=$LEAGUE_YEAR \
-e TEST=True \
ff_bot
or through an .env file
docker run -td --rm --env-file .env ff_bot
and look up the logs at docker logs <container id>
Describe alternatives you've considered
This request is related to #74 but doesn't require any additional API creations. It's a pretty niche feature that is solved by making an additional image.
Additional comments
Thanks for the updates for this unpredictable fantasy season. 👍
When a match is tied, the Trophies of the Week section of the final score update says
"team1 barely beat team 2 by a margin of 0.00"
To Reproduce
A team ties
Expected behavior
To show that the closes match was a tie, rather than describe one team as beating the other
Chat application
slack
Additional context
Clicking the purple button brings me to a page on heroku that just states:
"No app.json located in the repo URL provided.
Make sure that an app.json file exists in the project root directory."
Is your feature request related to a problem? Please describe.
It is frustrating when the bot sends close scores of teams that have no players playing in the Monday night game.
Describe the solution you'd like
Check the rosters of games with close scores for active players. Ideally the bot would only send close scores of games where the team that is behind has an active player in.
These scheduled messages seem like an ideal use case for running as scheduled, serverless function in order to minimize the amount of compute needed to run this workload. Also management would be easier as there would be no need to keep the process running.
Is there any interest in some basic scaffolding code and documentation around getting this to code to work as a scheduled Azure Function? Ideally there would be an easy deployment script (terraform, bash, powershell, whatever) that folks can run to handle the deployment.
The bot keeps crashing for me... here is the traceback of the error.
2018-09-12T03:32:33.220122+00:00 app[worker.1]: Traceback (most recent call last):
2018-09-12T03:32:33.220141+00:00 app[worker.1]: File "ff_bot/ff_bot.py", line 245, in
2018-09-12T03:32:33.220818+00:00 app[worker.1]: bot_main("init")
2018-09-12T03:32:33.220820+00:00 app[worker.1]: File "ff_bot/ff_bot.py", line 220, in bot_main
2018-09-12T03:32:33.221093+00:00 app[worker.1]: bot.send_message(text)
2018-09-12T03:32:33.221096+00:00 app[worker.1]: File "ff_bot/ff_bot.py", line 32, in send_message
2018-09-12T03:32:33.221267+00:00 app[worker.1]: raise GroupMeException('Invalid BOT_ID')
2018-09-12T03:32:33.221300+00:00 app[worker.1]: main.GroupMeException: Invalid BOT_ID
I have tried to re enter and change the groupme bot id, but it isnt working. Help please!
After I followed the config setup in the instructions I went to resources to turn on the bot but there was a message "This app has no process yet" did I miss something in the instructions?
I'm not getting the scoreboard or close score messages. Any thing different this year from last?
consider using UTC to schedule the announcements, or disabling time zone settings all together. I live on the west coast so i changed the settings in Heroku to Los_Angeles. The posting from the bot comes at specified times daily. Thus changing my made the messages come later then they should (for instance the thursday game matchup messages came mid game for me).
I did not receive the scoreboard update today at 4:00 PM ET I am using GroupMe with a private ESPN League I have had no issues with this in the past.
Leagues with no trade deadline crash on deploy
Add top 1/2 of league to trophy call out on tuesday morning. Make it an optional message by default and environment variable to enable.
This is to help with the "2 games a week" system, where everyone gets their H2H game as well as top 1/2 of scorers getting a W and bottom half a L.
We've installed the bot in a groupMe chat in our league and the power rankings haven't updated since week 4. I've forked the project so I could toy with it myself and see if I could debug the issue but just don't have the time to get into it right now with school. Anyone else noticed this? Any idea why? The code looks fine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.