more thread improvements
3 files changed, 5 insertions, 2 deletions
diff --git a/src/api/routes/channels/#channel_id/threads.ts b/src/api/routes/channels/#channel_id/threads.ts
index 79392fe6..9c1a1d0b 100644
--- a/src/api/routes/channels/#channel_id/threads.ts
+++ b/src/api/routes/channels/#channel_id/threads.ts
@@ -68,7 +68,7 @@ router.post(
name: body.name,
guild_id: channel.guild_id,
rate_limit_per_user: body.rate_limit_per_user,
- type: body.type,
+ type: body.type || (channel.threadOnly() ? ChannelType.GUILD_PUBLIC_THREAD : ChannelType.GUILD_PRIVATE_THREAD),
recipients: [],
thread_metadata: {
archived: false,
diff --git a/src/schemas/uncategorised/ThreadCreationSchema.ts b/src/schemas/uncategorised/ThreadCreationSchema.ts
index ca1f25e2..1ad85ce7 100644
--- a/src/schemas/uncategorised/ThreadCreationSchema.ts
+++ b/src/schemas/uncategorised/ThreadCreationSchema.ts
@@ -24,7 +24,7 @@ export interface ThreadCreationSchema {
auto_archive_duration?: number;
rate_limit_per_user?: number;
name: string;
- type: ChannelType.GUILD_PUBLIC_THREAD | ChannelType.GUILD_PRIVATE_THREAD;
+ type?: ChannelType.GUILD_PUBLIC_THREAD | ChannelType.GUILD_PRIVATE_THREAD;
invitable?: boolean;
applied_tags?: string[];
location?: string; //Ignore it
diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts
index d57d8361..751fa3ad 100644
--- a/src/util/entities/Channel.ts
+++ b/src/util/entities/Channel.ts
@@ -281,6 +281,9 @@ export class Channel extends BaseClass {
return ret;
}
+ threadOnly() {
+ return this.type === ChannelType.GUILD_FORUM || this.type === ChannelType.GUILD_MEDIA;
+ }
static async createThreadChannel(
channel: Partial<Channel>,
|