summary refs log tree commit diff
path: root/src/util/entities
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-01-14 13:25:16 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-01-14 13:25:16 +0100
commitb3657f2cc89bd67d1879f2a5f6589bb1cd11ff08 (patch)
tree1cad59bf6ea6f84011e6b2af04bbe3643fb332f0 /src/util/entities
parentMove rest of endpoints that return nothing into v0 (diff)
downloadserver-ts-b3657f2cc89bd67d1879f2a5f6589bb1cd11ff08.tar.xz
Move isTextChannel to channel
Signed-off-by: TheArcaneBrony <myrainbowdash949@gmail.com>
Diffstat (limited to 'src/util/entities')
-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 aaddc001..23f2ea55 100644 --- a/src/util/entities/Channel.ts +++ b/src/util/entities/Channel.ts
@@ -450,6 +450,30 @@ export class Channel extends BaseClass { ]; return disallowedChannelTypes.indexOf(this.type) == -1; } + + isTextChannel(): boolean { + switch (this.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); + } + } } export interface ChannelPermissionOverwrite {