1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 20:52:42 +01:00

Added missing permissions and channel types

This commit is contained in:
AlTech98 2021-09-04 11:43:09 +02:00
parent b965d93e51
commit a3c8ab163a
3 changed files with 22 additions and 1 deletions

View File

@ -17,11 +17,15 @@ export function isTextChannel(type: ChannelType): boolean {
switch (type) {
case ChannelType.GUILD_STORE:
case ChannelType.GUILD_VOICE:
case ChannelType.GUILD_STAGE_VOICE:
case ChannelType.GUILD_CATEGORY:
throw new HTTPError("not a text channel", 400);
case ChannelType.DM:
case ChannelType.GROUP_DM:
case ChannelType.GUILD_NEWS:
case ChannelType.GUILD_NEWS_THREAD:
case ChannelType.GUILD_PUBLIC_THREAD:
case ChannelType.GUILD_PRIVATE_THREAD:
case ChannelType.GUILD_TEXT:
return true;
}

View File

@ -16,6 +16,10 @@ 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
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
GUILD_STAGE_VOICE = 13, // a voice channel for hosting events with an audience
}
@Entity("channels")

View File

@ -46,7 +46,13 @@ type PermissionString =
| "MANAGE_NICKNAMES"
| "MANAGE_ROLES"
| "MANAGE_WEBHOOKS"
| "MANAGE_EMOJIS_AND_STICKERS";
| "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
@ -85,6 +91,13 @@ export class Permissions extends BitField {
MANAGE_ROLES: BigInt(1) << BigInt(28),
MANAGE_WEBHOOKS: BigInt(1) << BigInt(29),
MANAGE_EMOJIS_AND_STICKERS: BigInt(1) << BigInt(30),
USE_APPLICATION_COMMANDS: BigInt(1) << BigInt(31),
REQUEST_TO_SPEAK: BigInt(1) << BigInt(32),
MANAGE_THREADS: BigInt(1) << BigInt(34),
USE_PUBLIC_THREADS: BigInt(1) << BigInt(35),
USE_PRIVATE_THREADS: BigInt(1) << BigInt(36),
USE_EXTERNAL_STICKERS: BigInt(1) << BigInt(37),
/**
* CUSTOM PERMISSIONS ideas:
* - allow user to dm members