chipmunkbot-archive/cperms.js
2023-06-26 23:26:15 -04:00

23 lines
No EOL
493 B
JavaScript

let codes = [null, Math.random(), Math.random()]
printCodes()
function validate(level, code) {
for (let i = level; i < codes.length; i++) {
if (codes[i] === code) {
codes[i] = Math.random()
console.log(`New code for level ${i}: ${codes[i]}`)
return true
}
}
return false
}
function printCodes() {
console.log('Codes: ')
for (const i in codes) {
console.log(`Permission level ${i}: ${codes[i]}`)
}
}
module.exports = { codes, validate, printCodes }