Introducing: the Soccerstatsbot

In the last couple of years many digital assistants have entered the market. You most definitely have heard of Alexa, Cortana and Siri. I wanted to know how these things work and decided to start a little project that grew and grew over time and resulted in my blog not being updated for quite some time. This project is the soccerstatsbot. Originally I wanted to create a bot that would find questions in the comments of the soccer subreddit and answer them. However I changed my mind and finally decided to create a chat interface that talks to a bot. The user would then be able to ask the bot soccer questions.

Without further ado, here is the current start page of the soccerstatsbot: 

The soccerstatsbot interface


  • flexible interface to display tables and fixtures from the following five leagues
    • Premier League (England)
    • La Liga (Spain)
    • Bundesliga (Germany)
    • Serie A (Italy)
    • Ligue 1 (France)
  • query for
    • tables (single or multiple seasons)
    • titles and rank
    • goals, assists and scorers
    • matchdays
    • fixtures
  • responsive design

As you can see the interface is very simple and just contains some basic bootstrap4 elements. The user can choose one of the example sentences or type a request in the message box. Pressing return or clicking on Send will send the request to the bot. The button Clear History will delete every request from the history. Over the next paragraphs I will show you the types of answers the soccerbot is able to give by going through the examples that can be clicked on the initial screen.

With a title query you can get the final table of a specific season

Rank Query - Who won the Premier League in 2003? 

A rank query can be used to retrieve information about the placement of a team in a given season. This query is not limited to the first place of a table. Hint: use the word rank if you want to know something about a specific rank. The bot doesn't seem to react as well to place. In the picture you can see a rank table. This table display a part of a complete table and marks a team in green. Usually this would be the team or rank you were interested in. This type of query can be used with multiple seasons as well.  You can find out which team is 7th on the aggregated table of the Bundesliga between 1998 and 2003. It's Werder Bremen of course. 

Title Query - Which team won the most Bundesliga titles in the 80s?

Title Queries or Placement Queries can be used to find out which teams finished in a specific place over multiple seasons. Since we are already very interested in the Bundesliga between 1998 and 2003 you can guess now which teams finished 7th in each of the seasons. You guessed right: 

  • MSV Duisburg finished 7th in 1998 and 1999
  • VfB Stuttgart finished 7th in 2000 and 2002
  • 1.FC Kaiserslautern finisehd 7th in 2001
  • VfL Wolfsburg finished 7th in 2003

Hint: Since the bot might not know if you are interested in the aggregated table or the individual seasons it will display both and you can tab between them.

With a title query you can get a summary of the champions of multiple seasons

Table Query - Show me the Bundesliga table

A table query is another very basic query. It will display the table of a given timespan. You can use the keywords season and matchday to narrow your search. The bot will also detect dates. 
Hint: Always use the keyword matchday in front of a number. The bot won't necessarily detect someting like "from matchday 7 to 15". Use "from matchday 7 to matchday 15".


The current season is the default season for the bot

Goals Query - Who shot the most goals in La Liga in 1999?

If you are interested in the performances of a single player then you can access player stats with goal, assist and scorer queries. Just flavour your query with these keywords ("goals", "assists" and "scorers") and the bot will most likey answer with a cool searchable table. 
Hint: You can use the search to show only players of a certain team.

You can also query assists and scorers (goals + assists)

Fixture Query - Show me the next 5 fixtures of Manchester United

The fixture query can be used to display fixtures of a given team. You can also query for multiple teams. This will show you a list of all the fixtures where two of the given teams played against each other.
Hint: if you are interested in the performances of a single team against specific other teams just query for the last 2000 games of the team and use the search box to only display fixtures against a specific team

You can also query past fixtures and search for multiple teams

Matchday Query - Ligue 1 Matchday 5 in 2013

The matchday query is a combination of the table and the fixture query. It will show you the fixtures and the table of a given matchday.

A matchday query displays the matches and the table of a given matchday and season

In the upcoming weeks I will create more blog posts about the bot with more tips & tricks as well as technical insight into the bots inner workings. For now if you have any questions feel free to send me a message on twitter or leave a comment.