fix(ThreadChannel): Make ownerId always present

#10618 djs
This commit is contained in:
Elysia
2025-01-21 00:58:18 +07:00
parent 6170b3755b
commit 963d244d07
2 changed files with 7 additions and 11 deletions

View File

@@ -24,6 +24,12 @@ class ThreadChannel extends Channel {
*/ */
this.guild = guild; this.guild = guild;
/**
* The id of the member who created this thread
* @type {Snowflake}
*/
this.ownerId = data.owner_id;
/** /**
* The id of the guild the channel is in * The id of the guild the channel is in
* @type {Snowflake} * @type {Snowflake}
@@ -117,16 +123,6 @@ class ThreadChannel extends Channel {
this._createdTimestamp ??= this.type === 'GUILD_PRIVATE_THREAD' ? super.createdTimestamp : null; this._createdTimestamp ??= this.type === 'GUILD_PRIVATE_THREAD' ? super.createdTimestamp : null;
if ('owner_id' in data) {
/**
* The id of the member who created this thread
* @type {?Snowflake}
*/
this.ownerId = data.owner_id;
} else {
this.ownerId ??= null;
}
if ('last_message_id' in data) { if ('last_message_id' in data) {
/** /**
* The last message id sent in this thread, if one was sent * The last message id sent in this thread, if one was sent

2
typings/index.d.ts vendored
View File

@@ -3371,7 +3371,7 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel, ['fetchWebhook
public messageCount: number | null; public messageCount: number | null;
public members: ThreadMemberManager; public members: ThreadMemberManager;
public name: string; public name: string;
public ownerId: Snowflake | null; public ownerId: Snowflake;
public readonly parent: TextChannel | NewsChannel | ForumChannel | MediaChannel | null; public readonly parent: TextChannel | NewsChannel | ForumChannel | MediaChannel | null;
public parentId: Snowflake | null; public parentId: Snowflake | null;
public rateLimitPerUser: number | null; public rateLimitPerUser: number | null;