pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 1 | const logs = [ |
| 2 | "channelUpdate", |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 3 | "channelPinsUpdate", // TODO |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 4 | "emojiUpdate", |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 5 | "stickerUpdate", // TODO |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 6 | "guildUpdate", |
| 7 | "guildMemberUpdate", |
| 8 | "guildMemberPunish", |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 9 | "guildRoleUpdate", |
| 10 | "guildInviteUpdate", |
| 11 | "messageUpdate", |
| 12 | "messageDelete", |
| 13 | "messageDeleteBulk", |
| 14 | "messageReactionUpdate", |
| 15 | "messagePing", |
| 16 | "messageMassPing", |
pineafan | 6702cef | 2022-06-13 17:52:37 +0100 | [diff] [blame] | 17 | "messageAnnounce", // TODO |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 18 | "threadUpdate", |
pineafan | c6158ab | 2022-06-17 16:34:07 +0100 | [diff] [blame] | 19 | "webhookUpdate", // TODO |
pineafan | 412beec | 2022-06-29 21:46:26 +0100 | [diff] [blame] | 20 | "guildMemberVerify", |
pineafan | c6158ab | 2022-06-17 16:34:07 +0100 | [diff] [blame] | 21 | "autoModeratorDeleted", // TODO |
| 22 | "nucleusSettingsUpdated", // TODO |
| 23 | "" |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 24 | ] |
| 25 | |
| 26 | const tickets = [ |
| 27 | "support", |
| 28 | "report", |
| 29 | "question", |
| 30 | "issue", |
| 31 | "suggestion", |
| 32 | "other" |
| 33 | ] |
| 34 | |
| 35 | const toHexInteger = (permissions, array?) => { |
| 36 | if (!array) { |
| 37 | array = logs; |
| 38 | } |
| 39 | let int = 0n; |
| 40 | |
| 41 | for(let perm of permissions) { |
| 42 | int += BigInt(2 ** array.indexOf(perm)); |
| 43 | } |
| 44 | return int.toString(16) |
| 45 | } |
| 46 | |
| 47 | const toHexArray = (permissionsHex, array?) => { |
| 48 | if (!array) { |
| 49 | array = logs; |
| 50 | } |
| 51 | let permissions = []; |
| 52 | let int = (BigInt("0x" + permissionsHex)).toString(2).split('').reverse(); |
| 53 | for (let index in int) { |
| 54 | if (int[index] == "1") { |
| 55 | permissions.push(array[index]); |
| 56 | } |
| 57 | } |
| 58 | return permissions; |
| 59 | } |
| 60 | |
| 61 | export { |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame] | 62 | toHexInteger, |
| 63 | toHexArray, |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 64 | tickets, |
| 65 | logs |
| 66 | } |