From b438f2b071dbaa82371016168ab843f24be5063e Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sun, 16 Apr 2023 01:51:52 +1000 Subject: Rewrite getRouteDescriptions, fix message route not appearing in openapi spec --- src/util/entities/Channel.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/util/entities/Channel.ts') 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); + } +} -- cgit 1.5.1