chipmunkbot-archive/cperms.js

23 lines
493 B
JavaScript
Raw Normal View History

2023-06-26 23:26:15 -04:00
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 }