diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-04-16 01:51:52 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2023-04-16 01:51:52 +1000 |
commit | b438f2b071dbaa82371016168ab843f24be5063e (patch) | |
tree | eea50564f94b6992089ce097455404d89cd0ba56 /src/util/entities | |
parent | generated files (diff) | |
download | server-b438f2b071dbaa82371016168ab843f24be5063e.tar.xz |
Rewrite getRouteDescriptions, fix message route not appearing in openapi spec
Diffstat (limited to 'src/util/entities')
-rw-r--r-- | src/util/entities/Channel.ts | 24 |
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); + } +} |