diff --git a/packages/discord.js/src/structures/PartialGroupDMChannel.js b/packages/discord.js/src/structures/PartialGroupDMChannel.js index 7c79f1eec439..935ca5f5c65c 100644 --- a/packages/discord.js/src/structures/PartialGroupDMChannel.js +++ b/packages/discord.js/src/structures/PartialGroupDMChannel.js @@ -54,6 +54,35 @@ class PartialGroupDMChannel extends BaseChannel { } else { this.ownerId ??= null; } + + if ('last_message_id' in data) { + /** + * The channel's last message id, if one was sent + * @type {?Snowflake} + */ + this.lastMessageId = data.last_message_id; + } else { + this.lastMessageId ??= null; + } + + if ('last_pin_timestamp' in data) { + /** + * The timestamp when the last pinned message was pinned, if there was one + * @type {?number} + */ + this.lastPinTimestamp = data.last_pin_timestamp; + } else { + this.lastPinTimestamp ??= null; + } + } + + /** + * The date when the last pinned message was pinned, if there was one + * @type {?Date} + * @readonly + */ + get lastPinAt() { + return this.lastPinTimestamp && new Date(this.lastPinTimestamp); } /** diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index a07efa12791b..d8da64f2e4c5 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2559,6 +2559,9 @@ export class PartialGroupDMChannel extends BaseChannel { public recipients: PartialRecipient[]; public messages: PartialGroupDMMessageManager; public ownerId: Snowflake | null; + public lastMessageId: Snowflake | null; + public lastPinTimestamp: number | null; + get lastPinAt(): Date | null; public iconURL(options?: ImageURLOptions): string | null; public fetchOwner(options?: BaseFetchOptions): Promise; public toString(): ChannelMention;