mirror of
https://github.com/ssyyhhrr/stewardle.git
synced 2025-11-15 21:33: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 pastDrivers = []
|
||||
let driver
|
||||
|
||||
let year = new Date().getFullYear()
|
||||
@@ -160,6 +161,13 @@ async function updateDrivers() {
|
||||
function dotd() {
|
||||
console.log("Selecting Driver of the Day...")
|
||||
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(drivers[driver])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user