📝 added comments and updated type
This commit is contained in:
parent
c59ccf2176
commit
eea12afe0b
@ -16,6 +16,7 @@ export enum ChannelType {
|
|||||||
GUILD_CATEGORY = 4, // an organizational category that contains up to 50 channels
|
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_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
|
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_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_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
|
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
|
||||||
|
@ -15,46 +15,9 @@ try {
|
|||||||
|
|
||||||
export type PermissionResolvable = bigint | number | Permissions | PermissionResolvable[] | PermissionString;
|
export type PermissionResolvable = bigint | number | Permissions | PermissionResolvable[] | PermissionString;
|
||||||
|
|
||||||
type PermissionString =
|
type PermissionString = keyof typeof Permissions.FLAGS;
|
||||||
| "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";
|
|
||||||
|
|
||||||
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 {
|
export class Permissions extends BitField {
|
||||||
cache: PermissionCache = {};
|
cache: PermissionCache = {};
|
||||||
@ -93,6 +56,7 @@ export class Permissions extends BitField {
|
|||||||
MANAGE_EMOJIS_AND_STICKERS: BigInt(1) << BigInt(30),
|
MANAGE_EMOJIS_AND_STICKERS: BigInt(1) << BigInt(30),
|
||||||
USE_APPLICATION_COMMANDS: BigInt(1) << BigInt(31),
|
USE_APPLICATION_COMMANDS: BigInt(1) << BigInt(31),
|
||||||
REQUEST_TO_SPEAK: BigInt(1) << BigInt(32),
|
REQUEST_TO_SPEAK: BigInt(1) << BigInt(32),
|
||||||
|
// TODO: what is permission 33?
|
||||||
MANAGE_THREADS: BigInt(1) << BigInt(34),
|
MANAGE_THREADS: BigInt(1) << BigInt(34),
|
||||||
USE_PUBLIC_THREADS: BigInt(1) << BigInt(35),
|
USE_PUBLIC_THREADS: BigInt(1) << BigInt(35),
|
||||||
USE_PRIVATE_THREADS: BigInt(1) << BigInt(36),
|
USE_PRIVATE_THREADS: BigInt(1) << BigInt(36),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user