Skip to content

Commit

Permalink
fix(PartialGroupDMChannel): add missing ownerId property
Browse files Browse the repository at this point in the history
  • Loading branch information
imnaiyar committed Sep 13, 2024
1 parent 495bc60 commit 8a3bdbb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/discord.js/src/structures/PartialGroupDMChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand All @@ -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<User>}
*/
async fetchOwner(options) {
return this.client.users.fetch(this.ownerId, options);
}

delete() {
return Promise.reject(new DiscordjsError(ErrorCodes.DeleteGroupDMChannel));
}
Expand Down
2 changes: 2 additions & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<User>;
public toString(): ChannelMention;
}

Expand Down

0 comments on commit 8a3bdbb

Please sign in to comment.