Giter VIP home page Giter VIP logo

fantasy_football_chat_bot's People

Contributors

cwendt94 avatar dtcarls avatar inbleric avatar jasonfreeberg avatar joshstubble avatar rbarton65 avatar sdvgallardo avatar tylersiskar avatar zachmyers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fantasy_football_chat_bot's Issues

Can't Activate on Non-Owner GroupMe

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!

Power Rankings Not Updating

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.

Add top 1/2 of league scores to trophy output

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.

Repeated Init messages

Describe the bug
The predetermined INIT messages are being sent roughly at the same time every day since deployment.

To Reproduce
Deploy this bot in Heroku with roughly these settings:
image

Expected behavior
Init message only comes up once

readme wrong

you said updates at 430/730 but looking at code you send at 16,20

Don't send close scores of games with no players playing Monday night

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.

FF Bot is not sending init message to Slack

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.

image

Any help is appreciated!

Matchups message broken

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

Config Problem

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?

Score update has inflated scores for a matchup

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)

Heroku link broken?

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."

SSLError [WRONG_VERSION_NUMBER]

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)')))

Projected scores incorrect when player scores 0

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.

Consider using MeBots to allow users to add this bot to GroupMe chats automatically

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.

Additional context

[Feature Request] Making the Test Mode configurable through environment variables

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. 👍

Serverless Setup Boilerplate/Instructions

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.

Force message

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.

League Activity

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.

2020 Leagues

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.

Updated scores aren't displaying correctly

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

Screenshots
Screenshot_20190906-080353_GroupMe
Screenshot_20190906-080409_GroupMe

Chat application
GroupMe

Additional context
N/A

Heroku Deploy issues

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.

Log not deploying?

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?

ESPN scores are displaying 0.00

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

Screenshots
GM ESPN Bot

Chat application
GroupMe

Additional context

Private league access denied despite SWID and espn_s2 present

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?

Trophies of the Week gives "barely beat" descriptor to ties

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

Screenshots
image

Chat application
slack

Additional context

Utilize discord's embeded bot messages to make messages pretty

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

Bot not posting beyond week one.

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.
image

Chat application
SLACK

Additional context
Add any other context about the problem here.

timing of annoucements

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).

Deploy button on the Readme doesn't seem to be working

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.

Username and Password authentication

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.

Bot Crashing!

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!

Close scores inflated

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.

Power Rankings message did not send

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.