diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-04 12:17:26 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-04 12:17:26 +0200 |
commit | 8f002d14d56c6bb628aa45f0af00a21d1da397f0 (patch) | |
tree | 43ffaac3e0cf0b04f182f90c7f7e009de4202ab8 /util/src | |
parent | Added /guilds/:id/voice-states apis (diff) | |
download | server-8f002d14d56c6bb628aa45f0af00a21d1da397f0.tar.xz |
:pencil: added comments and updated type
Diffstat (limited to 'util/src')
-rw-r--r-- | util/src/entities/Channel.ts | 1 | ||||
-rw-r--r-- | util/src/util/Permissions.ts | 42 |
2 files changed, 4 insertions, 39 deletions
diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts index 486b5c44..fce85e3f 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts @@ -16,6 +16,7 @@ export enum ChannelType { GUILD_CATEGORY = 4, // an organizational category that contains up to 50 channels GUILD_NEWS = 5, // a channel that users can follow and crosspost into their own server GUILD_STORE = 6, // a channel in which game developers can sell their game on Discord + // TODO: what are channel types between 7-9? GUILD_NEWS_THREAD = 10, // a temporary sub-channel within a GUILD_NEWS channel GUILD_PUBLIC_THREAD = 11, // a temporary sub-channel within a GUILD_TEXT channel GUILD_PRIVATE_THREAD = 12, // a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission diff --git a/util/src/util/Permissions.ts b/util/src/util/Permissions.ts index 9cac0226..628a495d 100644 --- a/util/src/util/Permissions.ts +++ b/util/src/util/Permissions.ts @@ -15,46 +15,9 @@ try { export type PermissionResolvable = bigint | number | Permissions | PermissionResolvable[] | PermissionString; -type PermissionString = - | "CREATE_INSTANT_INVITE" - | "KICK_MEMBERS" - | "BAN_MEMBERS" - | "ADMINISTRATOR" - | "MANAGE_CHANNELS" - | "MANAGE_GUILD" - | "ADD_REACTIONS" - | "VIEW_AUDIT_LOG" - | "PRIORITY_SPEAKER" - | "STREAM" - | "VIEW_CHANNEL" - | "SEND_MESSAGES" - | "SEND_TTS_MESSAGES" - | "MANAGE_MESSAGES" - | "EMBED_LINKS" - | "ATTACH_FILES" - | "READ_MESSAGE_HISTORY" - | "MENTION_EVERYONE" - | "USE_EXTERNAL_EMOJIS" - | "VIEW_GUILD_INSIGHTS" - | "CONNECT" - | "SPEAK" - | "MUTE_MEMBERS" - | "DEAFEN_MEMBERS" - | "MOVE_MEMBERS" - | "USE_VAD" - | "CHANGE_NICKNAME" - | "MANAGE_NICKNAMES" - | "MANAGE_ROLES" - | "MANAGE_WEBHOOKS" - | "MANAGE_EMOJIS_AND_STICKERS" - | "USE_APPLICATION_COMMANDS" - | "REQUEST_TO_SPEAK" - | "MANAGE_THREADS" - | "USE_PUBLIC_THREADS" - | "USE_PRIVATE_THREADS" - | "USE_EXTERNAL_STICKERS"; +type PermissionString = keyof typeof Permissions.FLAGS; -const CUSTOM_PERMISSION_OFFSET = BigInt(1) << BigInt(48); // 16 free custom permission bits, and 16 for discord to add new ones +const CUSTOM_PERMISSION_OFFSET = BigInt(1) << BigInt(48); // 16 free custom permission bits, and 11 for discord to add new ones export class Permissions extends BitField { cache: PermissionCache = {}; @@ -93,6 +56,7 @@ export class Permissions extends BitField { MANAGE_EMOJIS_AND_STICKERS: BigInt(1) << BigInt(30), USE_APPLICATION_COMMANDS: BigInt(1) << BigInt(31), REQUEST_TO_SPEAK: BigInt(1) << BigInt(32), + // TODO: what is permission 33? MANAGE_THREADS: BigInt(1) << BigInt(34), USE_PUBLIC_THREADS: BigInt(1) << BigInt(35), USE_PRIVATE_THREADS: BigInt(1) << BigInt(36), |