Last active
October 23, 2019 22:42
-
-
Save kostimarko/2396799f5f289fc4f49e098938ae8aa9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
const GameData = await axios.get( | |
`https://api.mysportsfeeds.com/v2.1/pull/mlb/2019-regular/games.json?date=${now}&team=chicago-cubs`, | |
{ | |
auth: { | |
username: "*********", | |
password: "*********" | |
} | |
} | |
); | |
const { startTime } = GameData.data.games[0].schedule; | |
const { id } = GameData.data.games[0].schedule.venue; | |
const gameTime = momentTZ(startTime) | |
.tz("America/Chicago") | |
.format("HHmm"); | |
console.log(gameTime); | |
const timeCheck = 1500; | |
console.log(startTime); | |
if (id === 133) { | |
if (gameTime > timeCheck) { | |
const mailOptions = { | |
from: "yourEmailAddress@gmail.com", | |
to: mailList, | |
subject: "CUBS EVENING GAME - PARK CAREFULLY!", | |
html:'<p>dont park here</p>' | |
} | |
const mailSent = await transporter.sendMail(mailOptions); | |
console.log(mailSent); | |
} | |
} | |
} catch(error) { | |
console.log(error) | |
} | |
return true; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment