diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-09 23:29:22 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-09 23:29:22 +0200 |
commit | 438ed3e4c4296bfa8913c10a5879cee4ae623d7d (patch) | |
tree | ca3b1520f56eea6486d8c2284bc69fa1b7ce05e0 | |
parent | Remove some old test logs that expose info to console (diff) | |
download | server-438ed3e4c4296bfa8913c10a5879cee4ae623d7d.tar.xz |
Add rights calculator util script
-rw-r--r-- | bundle/scripts/rights.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bundle/scripts/rights.js b/bundle/scripts/rights.js new file mode 100644 index 00000000..89996418 --- /dev/null +++ b/bundle/scripts/rights.js @@ -0,0 +1,36 @@ +const path = require("path"); +const fs = require("fs"); +const { env } = require("process"); +const { execSync } = require("child_process"); +const { argv, stdout, exit } = require("process"); + +const { execIn, getLines, parts } = require("./utils"); + +let lines = fs.readFileSync(path.join(__dirname, "..", "..", "util", "src","util","Rights.ts")).toString() +let lines2 = lines.split("\n"); +let lines3 = lines2.filter(y=>y.includes(": BitFlag(")); +let lines4 = lines3.map(x=>x.split("//")[0].trim()) + +function BitFlag(int) { + return 1n << eval(`${int}n`); +} + +let rights = [] +let maxRights = 0n; +lines4.forEach(x=>{ + maxRights += eval(`rights.${x.replace(':'," = ").replace(",",";")}`) +}) +//max rights... +console.log(`Maximum rights: ${maxRights}`); +//discord rights... +discordRights = maxRights; +discordRights -= rights.SEND_BACKDATED_EVENTS; +discordRights -= rights.MANAGE_GUILD_DIRECTORY; +discordRights -= rights.CREDITABLE; +discordRights -= rights.BYPASS_RATE_LIMITS; +discordRights -= rights.ADD_MEMBERS; +discordRights -= rights.MANAGE_RATE_LIMITS; +discordRights -= rights.OPERATOR; +console.log(`Discord-like rights: ${discordRights}`); + +console.log(lines4) \ No newline at end of file |