summary refs log tree commit diff
path: root/ranks.js
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2024-11-30 14:24:39 +0200
committerWlodekM <[email protected]>2024-11-30 14:24:39 +0200
commit714a4189eb02051ddd330513048b07b3be070e27 (patch)
tree64112d5ce9d2b433cc4be0adf561ac128a3d84b5 /ranks.js
parentf37e3537adb59f2b724259a1720295756eb94277 (diff)
do stuff 3
Diffstat (limited to 'ranks.js')
-rw-r--r--ranks.js20
1 files changed, 0 insertions, 20 deletions
diff --git a/ranks.js b/ranks.js
deleted file mode 100644
index 78cab46..0000000
--- a/ranks.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import fs from 'node:fs';
-import path from 'node:path';
-import * as accounts from './accounts.ts'
-import { commands } from "./commands.ts";
-
-export function getRankData(name) {
-    if (!/^[^\/\\]*$/g.exec(name)) return null;
-    if (!fs.existsSync(path.join('ranks', `${name}.json`))) return null;
-    return JSON.parse(fs.readFileSync(path.join('ranks', `${name}.json`)))
-}
-
-export function canUserDoCommand(command, username, guest=false) {
-    let permissionLevel = 0;
-    if (!guest) {
-        const accountData = accounts.getAccountData(username);
-        if (getRankData(accountData?.admin ? 'admin' : accountData?.rank)) permissionLevel = getRankData(accountData?.admin ? 'admin' : accountData?.rank).level;
-    }
-    // Banned users can be given a rank with negative permissions so that no commands can be ran
-    return permissionLevel >= commands[command]?.level ?? 0
-}
\ No newline at end of file