mirror of
https://github.com/ssyyhhrr/stewardle.git
synced 2025-11-15 05:13:49 -05:00
7 Day Cooldown
This commit is contained in:
8
app.js
8
app.js
@@ -66,6 +66,7 @@ let stats = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let drivers = {}
|
let drivers = {}
|
||||||
|
let pastDrivers = []
|
||||||
let driver
|
let driver
|
||||||
|
|
||||||
let year = new Date().getFullYear()
|
let year = new Date().getFullYear()
|
||||||
@@ -160,6 +161,13 @@ async function updateDrivers() {
|
|||||||
function dotd() {
|
function dotd() {
|
||||||
console.log("Selecting Driver of the Day...")
|
console.log("Selecting Driver of the Day...")
|
||||||
driver = getRandomProperty(drivers)
|
driver = getRandomProperty(drivers)
|
||||||
|
if (pastDrivers.includes(driver)) {
|
||||||
|
console.log("Driver was picked recently, re-selecting...")
|
||||||
|
dotd()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pastDrivers.push(driver)
|
||||||
|
if (pastDrivers.length > 7) pastDrivers.shift()
|
||||||
console.log(`Driver of the Day is ${driver}!`)
|
console.log(`Driver of the Day is ${driver}!`)
|
||||||
console.log(drivers[driver])
|
console.log(drivers[driver])
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user