mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
feat(Message): Add method to resolve a component by id (#6484)
This commit is contained in:
@@ -817,6 +817,15 @@ class Message extends Base {
|
|||||||
return this.edit({ attachments: [] });
|
return this.edit({ attachments: [] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves a component by a custom id.
|
||||||
|
* @param {string} customId The custom id to resolve against
|
||||||
|
* @returns {?MessageActionRowComponent}
|
||||||
|
*/
|
||||||
|
resolveComponent(customId) {
|
||||||
|
return this.components.flatMap(row => row.components).find(component => component.customId === customId) ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used mainly internally. Whether two messages are identical in properties. If you want to compare messages
|
* Used mainly internally. Whether two messages are identical in properties. If you want to compare messages
|
||||||
* without checking all the properties, use `message.id === message2.id`, which is much more efficient. This
|
* without checking all the properties, use `message.id === message2.id`, which is much more efficient. This
|
||||||
|
|||||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -1169,6 +1169,7 @@ export class Message extends Base {
|
|||||||
public react(emoji: EmojiIdentifierResolvable): Promise<MessageReaction>;
|
public react(emoji: EmojiIdentifierResolvable): Promise<MessageReaction>;
|
||||||
public removeAttachments(): Promise<Message>;
|
public removeAttachments(): Promise<Message>;
|
||||||
public reply(options: string | MessagePayload | ReplyMessageOptions): Promise<Message>;
|
public reply(options: string | MessagePayload | ReplyMessageOptions): Promise<Message>;
|
||||||
|
public resolveComponent(customId: string): MessageActionRowComponent | null;
|
||||||
public startThread(options: StartThreadOptions): Promise<ThreadChannel>;
|
public startThread(options: StartThreadOptions): Promise<ThreadChannel>;
|
||||||
public suppressEmbeds(suppress?: boolean): Promise<Message>;
|
public suppressEmbeds(suppress?: boolean): Promise<Message>;
|
||||||
public toJSON(): unknown;
|
public toJSON(): unknown;
|
||||||
|
|||||||
Reference in New Issue
Block a user