@@ -267,6 +267,29 @@ class Message extends Base {
|
|||||||
this.poll ??= null;
|
this.poll ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.message_snapshots) {
|
||||||
|
/**
|
||||||
|
* The message associated with the message reference
|
||||||
|
* @type {Collection<Snowflake, Message>}
|
||||||
|
*/
|
||||||
|
this.messageSnapshots = data.message_snapshots.reduce((coll, snapshot) => {
|
||||||
|
const channel = this.client.channels.resolve(this.reference.channelId);
|
||||||
|
const snapshotData = {
|
||||||
|
...snapshot.message,
|
||||||
|
id: this.reference.messageId,
|
||||||
|
channel_id: this.reference.channelId,
|
||||||
|
guild_id: this.reference.guildId,
|
||||||
|
};
|
||||||
|
|
||||||
|
return coll.set(
|
||||||
|
this.reference.messageId,
|
||||||
|
channel ? channel.messages._add(snapshotData) : new this.constructor(this.client, snapshotData),
|
||||||
|
);
|
||||||
|
}, new Collection());
|
||||||
|
} else {
|
||||||
|
this.messageSnapshots ??= new Collection();
|
||||||
|
}
|
||||||
|
|
||||||
if ('application' in data) {
|
if ('application' in data) {
|
||||||
/**
|
/**
|
||||||
* Supplemental application information for group activities
|
* Supplemental application information for group activities
|
||||||
@@ -333,7 +356,7 @@ class Message extends Base {
|
|||||||
* @property {Snowflake} channelId The channel's id the message was referenced
|
* @property {Snowflake} channelId The channel's id the message was referenced
|
||||||
* @property {?Snowflake} guildId The guild's id the message was referenced
|
* @property {?Snowflake} guildId The guild's id the message was referenced
|
||||||
* @property {?Snowflake} messageId The message's id that was referenced
|
* @property {?Snowflake} messageId The message's id that was referenced
|
||||||
* @property {?MessageReferenceType} type The type of the message reference
|
* @property {MessageReferenceType} type The type of the message reference
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ('message_reference' in data) {
|
if ('message_reference' in data) {
|
||||||
@@ -403,19 +426,6 @@ class Message extends Base {
|
|||||||
} else {
|
} else {
|
||||||
this.call ??= null;
|
this.call ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('message_snapshots' in data) {
|
|
||||||
/**
|
|
||||||
* A collection of message snapshots
|
|
||||||
* @type {?Array<Partial<Message>>}
|
|
||||||
*/
|
|
||||||
this.snapshots = [];
|
|
||||||
for (const snapshot of data.message_snapshots) {
|
|
||||||
this.snapshots.push(new Message(this.client, snapshot.message));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.snapshots = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
22
typings/index.d.ts
vendored
22
typings/index.d.ts
vendored
@@ -2182,7 +2182,7 @@ export class Message<Cached extends boolean = boolean> extends Base {
|
|||||||
public call: MessageCall | null;
|
public call: MessageCall | null;
|
||||||
public flags: Readonly<MessageFlags>;
|
public flags: Readonly<MessageFlags>;
|
||||||
public reference: MessageReference | null;
|
public reference: MessageReference | null;
|
||||||
public snapshots: Partial<Message<false>>[] | null;
|
public messageSnapshots: Collection<Snowflake, MessageSnapshot>;
|
||||||
public position: number | null;
|
public position: number | null;
|
||||||
public awaitReactions(options?: AwaitReactionsOptions): Promise<Collection<Snowflake | string, MessageReaction>>;
|
public awaitReactions(options?: AwaitReactionsOptions): Promise<Collection<Snowflake | string, MessageReaction>>;
|
||||||
public createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
|
public createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
|
||||||
@@ -7138,6 +7138,26 @@ export interface MessageMentionOptions {
|
|||||||
|
|
||||||
export type MessageMentionTypes = 'roles' | 'users' | 'everyone';
|
export type MessageMentionTypes = 'roles' | 'users' | 'everyone';
|
||||||
|
|
||||||
|
export interface MessageSnapshot
|
||||||
|
extends Partialize<
|
||||||
|
Message,
|
||||||
|
null,
|
||||||
|
Exclude<
|
||||||
|
keyof Message,
|
||||||
|
| 'attachments'
|
||||||
|
| 'client'
|
||||||
|
| 'components'
|
||||||
|
| 'content'
|
||||||
|
| 'createdTimestamp'
|
||||||
|
| 'editedTimestamp'
|
||||||
|
| 'embeds'
|
||||||
|
| 'flags'
|
||||||
|
| 'mentions'
|
||||||
|
| 'stickers'
|
||||||
|
| 'type'
|
||||||
|
>
|
||||||
|
> {}
|
||||||
|
|
||||||
export interface MessageOptions {
|
export interface MessageOptions {
|
||||||
activity?: MessageActivity;
|
activity?: MessageActivity;
|
||||||
tts?: boolean;
|
tts?: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user