swapagarwal / JARVIS-on-Messenger

:speech_balloon: A community-driven python bot that aims to be as simple as possible to serve humans with their everyday tasks
https://m.me/J.A.R.V.I.S.on.Messenger
MIT License
1.34k stars 990 forks source link

Provide sports matches scores and info #249

Open saurabh-deochake opened 6 years ago

saurabh-deochake commented 6 years ago

In my opinion, we should build a new module which will fetch the scores of sports matches that are live currently. We can start with Cricket matches (then extend to Football and others) and to fetch the scores we can use espncricinfo api engines.

Are we already considering a sports module or we did in past? Please let me know because I do not intend to duplicate an issue.

edadesd commented 6 years ago

https://github.com/codophobia/pycricbuzz - A Python library that scrapes live scores from http://www.cricbuzz.com/ ; usage explained at http://shivammitra.com/cricbuzz-api-for-python/

https://github.com/codophobia/pycricket - Scrapes scores for past matches.

saurabh-deochake commented 6 years ago

@edadesd Yes. I am aware of that. I am just asking did we consider adding sports module earlier? If not, should we go ahead and do it?

edadesd commented 6 years ago

I can't find any other issues or PRs mentioning sports, so it doesn't look like the module would be duplicating any work. I just posted those links in case anyone who might potentially work on the module found them useful.

ahmedsadman commented 6 years ago

Is anyone working on this? If not, I am eager to do so.

saurabh-deochake commented 6 years ago

@ahmedsadman Even I am eager to do it. I already have source code ready for it. If you want, we can take this together. I have Cricket source code but if you are eager you may take football/soccer scores? Or vice versa, let me know.

ahmedsadman commented 6 years ago

@saurabh-deochake I searched for Soccer apis, but unfortunately found none that is FREE. If you have any API's in your mind, please let me know. And I would have liked to do the Cricket api, but as you already have source code, I don't want to ruin your work. After all, it would be my first contribution so I would like to start with something easy.

saurabh-deochake commented 6 years ago

@ahmedsadman I think this would work- http://api.football-data.org/index . Would you take a look at it, please?

ahmedsadman commented 6 years ago

@saurabh-deochake I checked it before you had asked. This API doesn't provide any LIVE score. It provides the following:

-Fixtures -Team Standings/Rankings -Team info -Player info etc.

So, are we okay with that? It would not show live results, but you can still see the standings and match results

saurabh-deochake commented 6 years ago

I guess for football, non-live feed would work. We can ask "Next match of Manchester United", "la liga matches this week", "champions league fixtures" and provide answers to these inputs.

With this at least we would have some information about soccer/football. Later on, we can add more sports.

What do you think?

ahmedsadman commented 6 years ago

Yes, I can start working into this right away. Let me explore the API thoroughly and I would give a list of what we can implement for a starting. But, we need the developers consent before starting to work in this feature, right?

edadesd commented 6 years ago

Nobody has objected to the idea of the module, and I think it sounds like a good thing for the bot to have. So it's my opinion that you're clear to at least start coding and to make a pull request.

Sent from my Samsung SAMSUNG-SM-G930A using FastHub

ahmedsadman commented 6 years ago

Okay, I am starting to work with the soccer module.

ahmedsadman commented 6 years ago

@saurabh-deochake I want to implement the following things for the soccer module, for the time being:

  1. "soccer code manchester united" will return the codename (in this case, MUFC) of the team manchester united, which will be used later for further query
  2. "soccer code leagues" would print league codenames which can be used for further query.
  3. "soccer live" would print the scores of live matches
  4. "soccer standings LEAGUE_CODENAME" would show the current standing of the given league.
  5. "soccer next match TEAM_CODE" would show the next match schedules in next 7 days.

Now I have a problem, how do I teach these messages to the AI? Do I need to create my own WIT api and teach it? @edadesd

saurabh-deochake commented 6 years ago

@ahmedsadman Instead of getting code and using that code for getting results, can we not directly provide name of the team/league? If I were the user of this module, I would directly query using team name instead of remembering league codes/team codes. Please correct me if I am wrong.

ahmedsadman commented 6 years ago

@saurabh-deochake ~~Here's the thing: generally 99% user would focus on one or two specific leagues as well as few specific teams, maybe their favorites. So, it would be better if they could write "soccer next match fcb" instead of "soccer next match barcelona", or "soccer next match mufc" instead of "soccer next match manchester united". This would save time and hassle. If I try to implement team names, the user would not get results if the the team spelling is incorrect. Besides, the API has a JSON list of teams and their details (code names, id) etc. The user input has to be exactly as it is written in the teams.json section. So which approach should I take?~~

Okay, your idea is correct. I will go with the team name search instead of team code search. Although team code search would be much faster because I could pass it directly as dictionary key

And, what about the messages I asked earlier? Do I need to create my own WIT api for testing purpose?

ahmedsadman commented 6 years ago

Why everyone is inactive, should I continue working on this feature?

saurabh-deochake commented 6 years ago

@ahmedsadman I am sorry I could not get time from work to reply you. Please refer to other modules, how they are built and try to follow the style. Feel free to continue working on this.

ahmedsadman commented 6 years ago

Yes, I am working, but I am stuck because I am facing some problem (see the bold section). I have also seen other modules and I know that I need access to WIT AI to test my code. My question was, do I need to create my own WIT account or the developer will teach that AI for me? If I create my own account, how the developer's gonna teach the AI if the pull request is approved? Because only I know what I taught the AI. Besides the new WIT version uses different response style and that's why I added pull req #255. Without that, my code won't work because there is no way mentioned in the website to use the OLDER version of WIT Ai. And seems the developer is not responding to the pull req @saurabh-deochake