diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-08-22 22:12:00 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-08-22 22:12:00 +1000 |
commit | afefa5d64bd6cde7d6efa3a9a5a3ec67a6ca29a8 (patch) | |
tree | 07779150eba77c27bf75bc0c7890f4a3f976716e /scripts/rights.js | |
parent | removed char joiners as they are actually useful, added page break (diff) | |
parent | Merge remote-tracking branch 'Puyodead1/patch/prettier-config' into staging (diff) | |
download | server-afefa5d64bd6cde7d6efa3a9a5a3ec67a6ca29a8.tar.xz |
Merge remote-tracking branch 'upstream/staging' into fix/categoryNames
Diffstat (limited to 'scripts/rights.js')
-rw-r--r-- | scripts/rights.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/rights.js b/scripts/rights.js new file mode 100644 index 00000000..20fd139c --- /dev/null +++ b/scripts/rights.js @@ -0,0 +1,34 @@ +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, "..", "src", "util", "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}`); \ No newline at end of file |