summary refs log tree commit diff
path: root/src/util/entities/Channel.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-29 01:11:22 +1000
committerGitHub <noreply@github.com>2023-04-29 01:11:22 +1000
commit009a3ad27f994318f72deb016ef4042cdd070865 (patch)
treea759056de60fb7ed285314e63d378315dfef40b0 /src/util/entities/Channel.ts
parentstart listening before starting components in bundle (diff)
parentMerge branch 'master' into openapi (diff)
downloadserver-009a3ad27f994318f72deb016ef4042cdd070865.tar.xz
Merge pull request #1032 from spacebarchat/openapi
Better OpenAPI
Diffstat (limited to 'src/util/entities/Channel.ts')
-rw-r--r--src/util/entities/Channel.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts

index 9ce04848..e23d93db 100644 --- a/src/util/entities/Channel.ts +++ b/src/util/entities/Channel.ts
@@ -482,3 +482,27 @@ export enum ChannelPermissionOverwriteType { member = 1, group = 2, } + +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: + case ChannelType.GUILD_FORUM: + case ChannelType.DIRECTORY: + 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: + case ChannelType.ENCRYPTED: + case ChannelType.ENCRYPTED_THREAD: + return true; + default: + throw new HTTPError("unimplemented", 400); + } +}