summary refs log tree commit diff
path: root/scripts/rights.js
blob: 20fd139c7501f4c58c406cf8f8fa6beeafa3aa1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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}`);