From 8a3bdbb260b9746e9472108b3198bde89d2db2c4 Mon Sep 17 00:00:00 2001 From: imnaiyar <137700126+imnaiyar@users.noreply.github.com> Date: Fri, 13 Sep 2024 07:25:46 -0500 Subject: [PATCH] fix(PartialGroupDMChannel): add missing ownerId property --- .../src/structures/PartialGroupDMChannel.js | 15 +++++++++++++++ packages/discord.js/typings/index.d.ts | 2 ++ 2 files changed, 17 insertions(+) diff --git a/packages/discord.js/src/structures/PartialGroupDMChannel.js b/packages/discord.js/src/structures/PartialGroupDMChannel.js index 704c8655753ce..0ac2e6cd9ffeb 100644 --- a/packages/discord.js/src/structures/PartialGroupDMChannel.js +++ b/packages/discord.js/src/structures/PartialGroupDMChannel.js @@ -44,6 +44,12 @@ class PartialGroupDMChannel extends BaseChannel { * @type {PartialGroupDMMessageManager} */ this.messages = new PartialGroupDMMessageManager(this); + + /** + * The user id of the owner of this Group DM Channel + * @type {Snowflake} + */ + this.ownerId = data.owner_id; } /** @@ -55,6 +61,15 @@ class PartialGroupDMChannel extends BaseChannel { return this.icon && this.client.rest.cdn.channelIcon(this.id, this.icon, options); } + /** + * Fetches the owner of this Group DM Channel. + * @param {BaseFetchOptions} [options] The options for fetching the user + * @returns {Promise} + */ + async fetchOwner(options) { + return this.client.users.fetch(this.ownerId, options); + } + delete() { return Promise.reject(new DiscordjsError(ErrorCodes.DeleteGroupDMChannel)); } diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 2ac27e78a990f..1b3515e147990 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2558,7 +2558,9 @@ export class PartialGroupDMChannel extends BaseChannel { public icon: string | null; public recipients: PartialRecipient[]; public messages: PartialGroupDMMessageManager; + public ownerId: Snowflake; public iconURL(options?: ImageURLOptions): string | null; + public fetchOwner(options?: BaseFetchOptions): Promise; public toString(): ChannelMention; }