blob: 6d0c55facb029cd76b04d68e33789fe2bafa9ee2 [file] [log] [blame]
const logs = [
"channelUpdate",
"emojiUpdate",
"stickerUpdate",
"guildUpdate",
"guildMemberUpdate",
"guildMemberPunish",
"guildRoleUpdate",
"guildInviteUpdate",
"messageUpdate",
"messageDelete",
"messageDeleteBulk",
"messageReactionUpdate",
"messageMassPing",
"messageAnnounce",
"threadUpdate",
"webhookUpdate",
"guildMemberVerify",
"autoModeratorDeleted",
"nucleusSettingsUpdated",
"ticketUpdate"
];
const tickets = [
"support",
"report",
"question",
"issue",
"suggestion",
"other"
];
const toHexInteger = (permissions, array?) => {
if (!array) {
array = logs;
}
let int = 0n;
for (const perm of permissions) {
int += BigInt(2 ** array.indexOf(perm));
}
return int.toString(16);
};
const toHexArray = (permissionsHex, array?) => {
if (!array) {
array = logs;
}
const permissions = [];
const int = BigInt("0x" + permissionsHex)
.toString(2)
.split("")
.reverse();
for (const index in int) {
if (int[index] === "1" && array.length > index) {
permissions.push(array[index]);
}
}
return permissions;
};
export { toHexInteger, toHexArray, tickets, logs };