Background
The API is really quite different now - the data structure isn't as nice for searching as everything is embedded within objects rather than indexed in array. Not sure how you want to do it, but hopefully this is a good start.
Current status
Looks for live matches
Looks for the events for each live match, calls postToSlack for events that have happened since the last update
postToSlack function just does echo of the text for now for testing
Example output
The match between Portugal / Spain is about to start!
0' :zap: The match between Portugal / Spain has started!
3' :exclamation: penalty Portugal!!!
4' :soccer: GOOOOAL Portugal!!! (RONALDO) Portugal 1 - 0 Spain
17' :collision: yellow card Spain (SERGIO)
24' :soccer: GOOOOAL Spain!!! (DIEGO COSTA) Portugal 1 - 1 Spain
28' :collision: yellow card Portugal (B. FERNANDES)
44' :soccer: GOOOOAL Portugal!!! (RONALDO) Portugal 2 - 1 Spain
45'+2' :toilet: HALF TIME Portugal 2 - 1 Spain
45' :runner: The match between Portugal / Spain has resumed
55' :soccer: GOOOOAL Spain!!! (DIEGO COSTA) Portugal 2 - 2 Spain
58' :soccer: GOOOOAL Spain!!! (NACHO) Portugal 2 - 3 Spain
88' :soccer: GOOOOAL Portugal!!! (RONALDO) Portugal 3 - 3 Spain
90'+5' :stopwatch: FULL TIME Portugal 3 - 3 Spain
The match between Peru / Denmark is about to start!
0' :zap: The match between Peru / Denmark has started!
38' :collision: yellow card Peru (TAPIA)
44' :exclamation: penalty Peru!!!
45'+1' :no_good: missed penalty Peru!!! (CUEVA) Peru 0 - 0 Denmark
45'+3' :toilet: HALF TIME Peru 0 - 0 Denmark
45' :runner: The match between Peru / Denmark has resumed
59' :soccer: GOOOOAL Denmark!!! (YURARY) Peru 0 - 1 Denmark
86' :collision: yellow card Denmark (DELANEY)
90'+3' :collision: yellow card Denmark (YURARY)
90'+6' :stopwatch: FULL TIME Peru 0 - 1 Denmark
Background The API is really quite different now - the data structure isn't as nice for searching as everything is embedded within objects rather than indexed in array. Not sure how you want to do it, but hopefully this is a good start.
Current status
postToSlack
for events that have happened since the last updatepostToSlack
function just doesecho
of the text for now for testingExample output The match between Portugal / Spain is about to start! 0' :zap: The match between Portugal / Spain has started! 3' :exclamation: penalty Portugal!!! 4' :soccer: GOOOOAL Portugal!!! (RONALDO) Portugal 1 - 0 Spain 17' :collision: yellow card Spain (SERGIO) 24' :soccer: GOOOOAL Spain!!! (DIEGO COSTA) Portugal 1 - 1 Spain 28' :collision: yellow card Portugal (B. FERNANDES) 44' :soccer: GOOOOAL Portugal!!! (RONALDO) Portugal 2 - 1 Spain 45'+2' :toilet: HALF TIME Portugal 2 - 1 Spain 45' :runner: The match between Portugal / Spain has resumed 55' :soccer: GOOOOAL Spain!!! (DIEGO COSTA) Portugal 2 - 2 Spain 58' :soccer: GOOOOAL Spain!!! (NACHO) Portugal 2 - 3 Spain 88' :soccer: GOOOOAL Portugal!!! (RONALDO) Portugal 3 - 3 Spain 90'+5' :stopwatch: FULL TIME Portugal 3 - 3 Spain
The match between Peru / Denmark is about to start! 0' :zap: The match between Peru / Denmark has started! 38' :collision: yellow card Peru (TAPIA) 44' :exclamation: penalty Peru!!! 45'+1' :no_good: missed penalty Peru!!! (CUEVA) Peru 0 - 0 Denmark 45'+3' :toilet: HALF TIME Peru 0 - 0 Denmark 45' :runner: The match between Peru / Denmark has resumed 59' :soccer: GOOOOAL Denmark!!! (YURARY) Peru 0 - 1 Denmark 86' :collision: yellow card Denmark (DELANEY) 90'+3' :collision: yellow card Denmark (YURARY) 90'+6' :stopwatch: FULL TIME Peru 0 - 1 Denmark