A fantasy football groupme bot
npm install espn-api npm i espn-api`Usage
$3
`const espn_api = require("espn-api"); `$3
`
const espnApi = require("espn-api").espnApi;
const api = new espnApi("username", "password", "462787");
(async()=>{
await api.login();
const standing = await api.getStandings();
const scores = await api.getScores();
await api.closeBrowser();
})()
`Method Details
$3
login() will login to espn leagues using the username and password that is passed in when the espn_api is initialized. Might be needed when getting private league data.
$3
getStandings() returns a Promise of an object of the format:
`
{
standings_list:
[ 'rank team_name',
'rank team_name',
'rank team_name',
...],
standings_map:
Map {
rank => [ strings in the same format above of all the teams of rank],
rank => [ strings in the same format above of all the teams of rank],
...}
}`$3
getScores() will return a Promise of an object of the format:
`
{ scoresAsList:
[ [ 'team_name', 'score' ],
[ 'team_name ', 'score' ],
[ 'team_name', 'score' ],
...],
scoreboards:
{ '0': { home: ['team_name', 'score'], away: ['team_name', 'score'] },
'1': { home: ['team_name', 'score'], away: ['team_name', 'score'] },
'2': {home: ['team_name', 'score'], away: ['team_name', 'score'] },
...}
}
``